Back to all posts

.NET Core 2.1 Upgrade - But I Followed the Instructions

Posted on Jun 29, 2018

Posted in category:

If you read my last post regarding the need to upgrade to .NET Core 2.1 you most likely have been working to upgrade your applications just like I have. Following the instructions to the "T" or so we thought. If you have done what I have, the transition is fairly smooth except for one common error that leads you down a crazy rabbit hole. Let us look at what I found, maybe it will help you.

The Error

After attempting a number of upgrades, every project ended up having this cryptic error

Warning NU1608 Detected package version outside of dependency constraint: Microsoft.CodeAnalysis.CSharp.Workspaces 2.3.1 requires Microsoft.CodeAnalysis.CSharp (= 2.3.1) but version Microsoft.CodeAnalysis.CSharp 2.8.0 was resolved.

This error causes every NuGet package to stop restoring and nothing would build. I went back and double checked the instructions, all manual changes to the CS Project file were completed, everything seemed to be correct. What was the issue?

The Fix

VS Screenshot

After triple checking the instructions I finally started manually reviewing the references. The instructions tell you to remove the DotNetCLI references, however, my project(s) all had additional references via simple NuGet packages for "Microsoft.VisualStudio.Web.CodeGenerator.Design." The fix is as simple as deleting this single entry from your references and all should be set.

As with many upgrade issues, the fix was simple. I hope this helps someone else!