Optimizely CMS running on .NET 7!
When I first started writing C# code, it was for .NET Framework 1.1 sometime in late 2003 using Visual Studio 2003 on a Windows 98 computer.
Fast-forward almost 20 years, and on November 8th 2022 .NET 7 was released. I'm usually not in a hurry to test the newest frameworks, but now it's been 10 days already! And a comment from a colleague on Slack today, saying he's started upgrading some stuff to .NET 7, made me wonder. Will Optimizely CMS run on .NET 7?
Only one way to find out, right? Test it myself!
Prerequisites
- You'll need the .NET 7 SDK
- You'll need Visual Studio 2022 v17.4 or newer
Upgrade
The required change to my project was only a single character. Simply change TargetFramework
from net6.0 to net7.0.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<EnablePreviewFeatures>True</EnablePreviewFeatures>
<Nullable>disable</Nullable>
</PropertyGroup>
For my yml pipeline definition in Azure DevOps, I added a step for using the new .NET 7.
- task: UseDotNet@2
displayName: 'use dotnet 7.0'
inputs:
packageType: 'sdk'
version: '7.0.x'
Then the last step was updating the .NET version on the Azure WebApp and triggering another deploy.
That's it, everything just worked! Not a single problem!
In about fifteen minutes this blog was running Optimizely CMS on .NET 7.