15
votes

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

2
System.Reflection.TypeExtensions 4.1.0 won't work, it's too old. You will need version 4.4DavidG
Question editted with exact errors. @DavidG Why is it taking packages not compatible with .net standard 2.0?SySc0d3r
Well you have installed some weird packages here. What is Remotion.Linq? That's not part of the standard library.DavidG
It's actually a dependence from Microsoft.EntityFrameworkCore, but it seems it takes an old version one.SySc0d3r
Oops I missed that. Still odd though, have you tried creating a fresh project?DavidG

2 Answers

8
votes

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.

7
votes

enter image description here

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