The upgrade from previous versions of .NET to .NET 6 can cause both build errors and runtime errors. The build errors can be easy to fix because you are notified and prevented from building the projects. The runtime errors, on the other hand are difficult to debug, unless you have full system tests already integrated.
Therefore, I would recommend making sure if you have tests that they all are passing before you start the upgrade process. This will ensure that after the upgrade is complete, you can run the tests and if all the tests pass then the upgrade was successful.
The best place to start is with your test projects (Unit Tests, Integration Tests, Acceptance Tests). Since these projects are responsible for confirming that your solution is working as intended its best to upgrade them first one by one and make sure they are still passing before moving onto other projects in your solution.
Following are the steps that I followed for each project to upgrade the .NET 6. I will also include a list of problems that I ran into in each step and the solutions that I found to fix them.
System.TypeInitializationException : The type initializer for 'Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor' threw an exception.
---- System.TypeInitializationException : The type initializer for 'Microsoft.EntityFrameworkCore.Query.QueryableMethods' threw an exception.
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
In Visual Studio right click on the project and navigate to Manage NuGet Packages. Under updates you will see a list of packages that need to be updated.
Note: I would recommend updating every package one by one Build and Test make sure the package does not break anything. This will help you debug if something does break.
Note: Some packages might not be compatible to .NET 6. So, if they have an update but are breaking and you cannot find a solution it might be easier to revert the update and wait for a new release to update that package.
Repeat the above steps on each project until the entire solution is updated.
To conclude, here are some recommendations I have to make the process easier and to have less problems.