Tags: .NET 6 CMS12 Optimizely/Episerver

If you want to upgrade – do not upgrade upgrade-assistant!

Today was the day. I was finally ready for upgrading to Optimizely CMS 12!

I have read every blog post and watched every YouTube video! My personal blog and some add-ons were upgraded months ago without too much hassle. I attended (and even spoke at) the local Optimizely Tech Forum last week, where the main topic was upgrading to Optimizely CMS 12.

I made sure to upgrade upgrade-assistant to the latest version and use the latest version of Optimizelys extension for upgrade-assistant.

Upgrade-assistant was upgraded like this, to version 0.4.346201.

dotnet tool update -g upgrade-assistant

I carefully crafted my upgrade command, like this.

upgrade-assistant upgrade "Project.csproj" 
   --skip-backup 
   --non-interactive 
   --ignore-unsupported-features 
   --extension "C:\Dev\Epi-source-updater"

After a second or two, this was what filled my screen  😱

Unhandled exception. System.ArgumentException: Type System.Collections.Generic.IReadOnlyCollection`1[System.String] cannot be created without a custom binder.    at System.CommandLine.Binding.ArgumentConverter.CreateEnumerable(Type type, Type itemType, Int32 capacity)    at System.CommandLine.Binding.ArgumentConverter.ConvertTokens(Argument argument, Type type, IReadOnlyList`1 tokens, LocalizationResources localizationResources, ArgumentResult argumentResult)    at System.CommandLine.Binding.ArgumentConverter.TryConvertArgument(ArgumentResult argumentResult, Object& value)    at System.CommandLine.Parsing.ArgumentResult.Convert(Argument argument)    at System.CommandLine.Parsing.ArgumentResult.GetArgumentConversionResult()    at System.CommandLine.Parsing.ParseResultVisitor.ValidateAndConvertArgumentResult(ArgumentResult argumentResult)    at System.CommandLine.Parsing.ParseResultVisitor.ValidateAndConvertOptionResult(OptionResult optionResult)    at System.CommandLine.Parsing.ParseResultVisitor.Stop()    at System.CommandLine.Parsing.ParseResultVisitor.Visit(SyntaxNode node)    at System.CommandLine.Parsing.Parser.Parse(IReadOnlyList`1 arguments, String rawInput)    at System.CommandLine.Parsing.ParserExtensions.InvokeAsync(Parser parser, String[] args, IConsole console)    at Microsoft.DotNet.UpgradeAssistant.Cli.Program.<Main>(String[] args)

After testing every single thing I could think of, I finally looked at the version of upgrade-assistant I upgraded to. It was released two days ago and only downloaded by 503 other people. 👀

After uninstalling the newer version, and installing the previous version – everything worked like a charm! 🎉

dotnet tool uninstall -g upgrade-assistant

dotnet tool install -g upgrade-assistant --version 0.4.336902 

Dotnet tool does not support downgrading, so we'll have to do uninstall and then a fresh install.

The latest versions of NuGet package upgrade-assistant

Also, be careful not to add a trailing backslash to the end of the extension path, because then upgrade-assistant will not be able to load the extension. If you run upgrade-assistant with the --non-interactive-flag, you could easily miss this warning. 

 Warning: Could not load extension from C:\Dev\Epi-source-updater"

The moral; if you want to upgrade Optimizely, do not upgrade upgrade-assistant!

It looks like it's a bug in upgrade-assistant.