There is some good documentation here how to manually upgrade to .NET 6: https://learn.microsoft.com/en-us/aspnet/core/migration/50-to-60
But I have a large solution with many projects that references many of NuGet-packages that need to be upgraded. Is there any automatic way to do upgrade the project files?
I used to do it with the "replace-in-files option" and NuGet-Manager in Visual Studio. Worked out for me in a 181 projects solution.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
Press Shift+Ctrl+H

Open NuGet-Manager for Solution (not project itself). Select all packages and update them all (if possible, else leave out the once you know are not compatible)
You can set properties for all projects in the solution using a Directory.Build.props file, see: https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2022#directorybuildprops-and-directorybuildtargets
In your case you'd use something like this:
<Project>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
Place the file in the root of your solution, above all project folders.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With