As long as your application does not use Blazor, upgrading from .Net 7 to .Net 8 is a walk in the park. The only obstacle we run into while upgrading the user group site was the publish task. Microsoft has made some simplifications to the runtime identifiers that are a breaking change.
For .Net 7 we used this command to create a self-contained package for Linux:
1 |
dotnet publish --self-contained --runtime ubuntu.20.04-x64 |
If we run this command with .Net 8, we get this useful error message with a link to the explanation why it no longer works:
Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1083: The specified RuntimeIdentifier ‘ubuntu.20.04-x64’ is not recognized. See https://aka.ms/netsdk1083 for more information.
All we need to do is to switch to this slightly modified command with the new runtime identifier for .Net 8:
1 |
dotnet publish --self-contained --runtime linux-x64 |
If you need a different target, you can choose from this list:
Linux
- linux-x64
- linux
- unix-x64
- unix
- any
Windows
- win-x64
- win
- any
MacOS
- osx-x64
- osx
- unix-x64
- unix
Conclusion
This breaking change in .Net 8 was, thanks to the useful error message, a thing we could fix immediately. I hope this kind of helpful error messages continues and will be used with other breaking changes in the future. It helps a lot, especially when I put it in contrast to our upgrade from .Net 4.8 to 6.