Package X is not compatible with netstandard2.0

SySc0d3r picture SySc0d3r · Aug 20, 2017 · Viewed 12.9k times · Source

I created a .NET Standard v2.0 project in Visual Studio 2017 v15.3.1 and I'm unable to install "Microsoft.EntityFrameworkCore 2.0.0" package in it (by Nuget 4.3). Previously the .NET SDK and Runtime, both 2.0.0, were installed.

The errors I get follow this pattern: "Package X is not compatible with netstandard2.0 (.NETStandard,Version=v2.0)." (i.e. System.Reflection.TypeExtensions 4.1.0).

What could it be causing these errors?

EDIT: I'll show the exact warnings and errors with an example (there are too many).

Restoring packages for [.csproj path]...

Warning:

Package "System.Collections 4.3.0" was restored using ".NETFramework,Version=v4.6.1" the project target framework ".NETStandard,Version=v2.0". This may cause compatibility problems.

...

Error:

Package Remotion.Linq 2.1.1 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Remotion.Linq 2.1.1 supports:

  • net35 (.NETFramework,Version=v3.5)
  • net40 (.NETFramework,Version=v4.0)
  • net45 (.NETFramework,Version=v4.5)
  • netstandard1.0 (.NETStandard,Version=v1.0)
  • portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)

...

Error restoring package. Reverting package changes for 'ClassLibrary1'.

Time elapsed: 00:00:02.4689637

========== Ended ==========

Answer

SySc0d3r picture SySc0d3r · Aug 20, 2017

Issue solved installing, independently, newer versions for each of the packages' dependencies which were showing error, so that the big package "Microsoft.EntityFrameworkCore 2.0.0" gets installed at last.

Hope it helps.

Edited: It happened to me another time and tried a faster solution. The key was deleting Nuget's cache from the packages' manager configuration.