Pages

Friday, May 13, 2022

Optimizely CMS 12 Installation Breaking Changes for Visual Studio 2019

Last October I wrote an article to act as an addendum to the Optimizely Documentation for starting a new CMS site using CMS 12 and .NET 5. Since then there have been some updates to the documentation and the packages involved. Today I got bit by one of them because I am using Visual Studio 2019, and if you are too this might save you some trouble.

Shameless link back.

You can check out my original article with some of those updates here:

The package name for Episerver.Templates changed as did the names of the templates within. They now sport the shiny, new Optimizely name instead of Episerver (though I am still partial to the latter, sorry). Additionally, some new templates have been added, and the package is now available via the Nuget.org feed.

However, there was a major change that stopped me dead in my tracks today while working through some other issues. 

[pause for suspense]

The Episerver.Templates were updated to .NET 6.

This just happened a couple days ago. And this might seem like a minor update as the package version is now 1.2.0 instead of 1.1.0. And for those using .NET 6 and Visual Studio 2022 this is exciting and a great update! But it has a pretty big impact if you're not. 

I am utilizing Visual Studio 2019 currently and I am not looking to change my installation anytime soon. Aside from comfort with the interface, and the stability of Visual Studio 2019, there are some kinks in the system that Microsoft is still trying to work out with VS 2022. I don't like to buy the first model year as the gremlins tend to get worked out by the first update (service pack). Furthermore, sometimes our machines are controlled and we just don't have permissions to change versions of our IDE in the middle of a project.

This is significant because Visual Studio 2019 does not support .NET 6. 

Also, the Optimizely documentation doesn't mention this part. At the time of writing this article, the top of the documentation page for Optimizely CMS 12 installation instructions points out .NET 5.

The Github readme for the templates package does mention Visual Studio 2022 for using the templates, but this wasn't an issue before the latest update. This is because they supported .NET 5 and so does Visual Studio 2019.

Now, if you attempt to pull down the Episerver.Templates package and install one of the site templates, from Empty CMS to Alloy, you won't have a happy build. Visual Studio 2019 will be very sad and confused.

Thankfully, if you have ended up in that situation you can fix it by uninstalling the current version of Episerver.Templates. Then, specify the previous version as part of your install command, as shown below. If you haven't installed it yet and are using Visual Studio 2019, just skip the uninstall.

For reference from the Github repo (https://github.com/episerver/content-templates/releases), the previous version is 1.1.0. 

[pre class="brush:bash;" title="Out with the new, and in with the old?"]
dotnet new -u Episerver.Templates
dotnet new -i Episerver.Templates::1.1.0 --nuget-source "https://api.nuget.org/v3/index.json"
[/pre]

This does mean that you might be missing other or future updates in Episerver.Templates 1.2.0 and higher, but it also means that you can still create a new Optimizely CMS site without upgrading to Visual Studio 2022 right away. 

Maybe Optimizely can maintain a .NET 5 and .NET 6 version of the package for a little while? Or, at the very least note this difference in the documentation. Just my .02¢.

No comments:

Post a Comment

Share your thoughts or ask questions...