Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package X is not compatible with netstandard2.0

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 ==========

like image 551
SySc0d3r Avatar asked Aug 20 '17 16:08

SySc0d3r


2 Answers

enter image description here

Clicking the "Clear all Nuget Caches" will resolve issue.

like image 78
Sudhakar Chavali Avatar answered Nov 04 '22 13:11

Sudhakar Chavali


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.

like image 24
SySc0d3r Avatar answered Nov 04 '22 13:11

SySc0d3r