Upgrade from .NET 5 to .NET 6
Why should you upgrade from .NET 5 to .NET 6?
- Because .NET 6 is so much faster?
- Because .NET 5 reached end-of-support on 10 May 2022?
- Because you want to use new features in C#10?
All of the above?
How do you upgrade?
Change your project file from this...
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
...to this...
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
...simply update the number 5 to 6.
What about hosting?
If you are running in Optimizely DXP, the environment should recognize the .NET 6 on your next deploy, and the appropriate container is used.
If you're hosting in Azure, you'll need to update the Major version for your WebApp in the configuration section.
That's it!