dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.85k stars 4.88k forks source link

Net Standard 2 is not compatible with Net Core 2 #1909

Closed wgutierrezr closed 6 years ago

wgutierrezr commented 6 years ago

I have multiple projects in one solution, two of them class libraries: Net Core 2 Class Library (EMS.Entities) and Net Standard 2 Razor UI class library (EMS.UIService), using VS 2017 Pro.

EMS.UIService cannot compile because the error (included dotnet restore command) : C:\Projects\EMS2\EMS\EMS.UIService\EMS.UIService.csproj : error NU1201: Project EMS.Entities is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project EMS.Entities supports: netcoreapp2.0 (.NETCoreApp,Version=v2.0) [C:\Projects\EMS2\EMS\EMS.sln]

I googled this error and did almost every recommendation to solve it but still the same error.

I will appreciate any suggestion to solve it.

Regards.

Petermarcu commented 6 years ago

Is the UIService Project a netstandard project while the Entities project is netcoreapp? You can't reference a netcoreapp project from a netstandard project. Only the other way around.

Petermarcu commented 6 years ago

You can switch the UIService class library project to be netcoreapp and it should work. Otherwise, you need to make the Entities project netstandard.

Petermarcu commented 6 years ago

I'm going to close this now. Let us know if you have more details or can clarify whether you were trying to have a .NET Standard Library reference a .NET Core library or the other way around.