C# – Packages are not compatible with netcoreapp2.0

cnetvisual studio

Today this error ocurred again. Visual Studio does not recognize most of the packages instaled in Microsoft.AspNetCore.All but I'm also getting problems with:

  • Microsoft.Extensions.Logging.Debug
  • Microsoft.VisualStudio.Web.CodeGenerators.Mvc
  • Microsoft.EntityFrameworkCore.Tools.DotNet

The error message is like this for every package:

The Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.0.0 package is not compatible with netcoreapp2.0 (.NETCoreApp, Version = v2.0). The Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.0.0 package supports: netstandard2.0 (.NETStandard, Version = v2.0)

I got pass this issue before doing the following:

  • Updating VS to version 15.3.1
  • Updating SDK to version 2.0

Now, I have updated NuGet.Commandline to 4.3 but the problem persists.

I'm also getting this alert:

There is no way to resolve the conflict between "System.Collections.NonGeneric, Version = 4.1.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" and "System.Collections.NonGeneric, Version = 4.0.1.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a ". "System.Collections.NonGeneric, Version = 4.1.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" will be chosen arbitrarily. Application D: \ Visual Studio \ MSBuild \ 15.0 \ Bin \ Microsoft.Common.CurrentVersion.targets 1964

Any other update I shall look into? Any help is welcome. Thanks

Best Answer

If you are using dotNET CLI, then just run this command,

dotnet nuget locals all --clear