Package X is not compatible with netstandard2.0
Asked Answered
O

2

23

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

Opportina answered 20/8, 2017 at 16:17 Comment(8)
System.Reflection.TypeExtensions 4.1.0 won't work, it's too old. You will need version 4.4Kedron
Question editted with exact errors. @Kedron Why is it taking packages not compatible with .net standard 2.0?Opportina
Well you have installed some weird packages here. What is Remotion.Linq? That's not part of the standard library.Kedron
It's actually a dependence from Microsoft.EntityFrameworkCore, but it seems it takes an old version one.Opportina
Oops I missed that. Still odd though, have you tried creating a fresh project?Kedron
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".Opportina
Are you sure you have the latest versions of everything installed?Kedron
I think so... .NET Core Runtime 2.0 .NET Core SDK 2.0. Pic: imgur.com/a/VYeu6Opportina
O
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.

Opportina answered 20/8, 2017 at 19:49 Comment(3)
What worked for me was using the Package Manager console in Visual Studio to install instead of the Manager Packages tool for the project.Allege
how di you delte nugets cache? was it by using dotnet nuget locals all –clearReganregard
what worked for me. removed reference to the project from the .csproj, and then clearing the nuget cache, then re-install libraryPears
F
15

enter image description here

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

Faerie answered 15/11, 2019 at 10:39 Comment(1)
This helped with same situation in VS2019 & 22Gramercy
O
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.

Opportina answered 20/8, 2017 at 19:49 Comment(3)
What worked for me was using the Package Manager console in Visual Studio to install instead of the Manager Packages tool for the project.Allege
how di you delte nugets cache? was it by using dotnet nuget locals all –clearReganregard
what worked for me. removed reference to the project from the .csproj, and then clearing the nuget cache, then re-install libraryPears

© 2022 - 2024 — McMap. All rights reserved.