June 29, 2018

.NET Core 2.1 Upgrade: But I Followed The Instructions

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!

tags: Quick Tips, .NET Core
comments powered by Disqus

Content provided in this blog is provided "AS-IS" and the information should be used at your own discretion.  The thoughts and opinions expressed are the personal thoughts of Mitchel Sellers and do not reflect the opinions of his employer.

Content Copyright

Content in this blog is copyright protected.  Re-publishing on other websites is allowed as long as proper credit and backlink to the article is provided.  Any other re-publishing or distribution of this content is prohibited without written permission from Mitchel Sellers.