I'm running Optimizely CMS 12 on .NET 8!
When .NET 8 was launched at Dotnetconf yesterday at 17:00 CET, less than six hours ago, I was at a .NET 8 Release Party hosted by Novanet, listening to a talk by Filip Ekberg.
Eager to test the latest and greatest, I updated my blog running Optimizely CMS 12 from .NET 7 to .NET 8 using only my phone. I bumped the runtime on the Azure environment, updated det YAML-file defining the build, and triggered a deploy at 17:15. It did not work! A little disappointed, I rolled back, still using only my phone.
A few hours (and beers) later, I finally sat down with a computer, and had a look at this error message.
I added the nuget package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation and added runtime view compilation like this.
services.AddRazorPages().AddRazorRuntimeCompilation();
But my views were still missing, so I added this to the .csproj-file.
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
<CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
<PreserveCompilationContext>true</PreserveCompilationContext>
I also switched the webapp back to .NET 8 runtime like this.
And updated the following task in my YML-file defining the build in Azure DevOps.
steps:
- task: UseDotNet@2
displayName: 'use dotnet 8.0'
inputs:
packageType: 'sdk'
version: '8.0.x'
Then, one more build and deploy! Great success, this blog is now running .NET 8.