22

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

SySc0d3r
  • 652
  • 1
  • 6
  • 18
  • System.Reflection.TypeExtensions 4.1.0 won't work, it's too old. You will need version 4.4 – DavidG Aug 20 '17 at 16:35
  • Question editted with exact errors. @DavidG Why is it taking packages not compatible with .net standard 2.0? – SySc0d3r Aug 20 '17 at 16:46
  • Well you have installed some weird packages here. What is `Remotion.Linq`? That's not part of the standard library. – DavidG Aug 20 '17 at 16:48
  • It's actually a dependence from Microsoft.EntityFrameworkCore, but it seems it takes an old version one. – SySc0d3r Aug 20 '17 at 16:50
  • Oops I missed that. Still odd though, have you tried creating a fresh project? – DavidG Aug 20 '17 at 16:54
  • Yeah, same error. Strange that EntityFrameworkCore dependes on a version of a package (i.e. it accepts Remotion.Linq >= 2.1.1) but when that package is being restored, it shows the error "not compatible with .netstandard2.0". – SySc0d3r Aug 20 '17 at 17:18
  • Are you sure you have the latest versions of everything installed? – DavidG Aug 20 '17 at 17:19
  • I think so... .NET Core Runtime 2.0 .NET Core SDK 2.0. Pic: http://imgur.com/a/VYeu6 – SySc0d3r Aug 20 '17 at 17:23

2 Answers2

14

enter image description here

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

Sudhakar Chavali
  • 809
  • 2
  • 14
  • 32
11

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.

SySc0d3r
  • 652
  • 1
  • 6
  • 18
  • What worked for me was using the Package Manager console in Visual Studio to install instead of the Manager Packages tool for the project. – Chucky Oct 17 '18 at 12:52
  • how di you delte nugets cache? was it by using dotnet nuget locals all –clear – user1709076 Sep 27 '19 at 11:54
  • what worked for me. removed reference to the project from the .csproj, and then clearing the nuget cache, then re-install library – Quak_2023 Jul 26 '23 at 14:13