Reputation: 95
I am building a .net core NUGET package in a .NET CORE 1.1 library using vs2017
I need to reference it in a vs2015 solution - for .net-core webapp targetting .NET framework library (Fwk 4.6.2) However, when I add reference of this nuget I get below issue. Any pointers to solve this are appreciated.
Package ClassLibNetCore 1.0.0 is not compatible with net462 (.NETFramework,Version=v4.6.2). Package ClassLibNetCore 1.0.0 supports: netcoreapp1.1 (.NETCoreApp,Version=v1.1)
One or more packages are incompatible with .NETFramework,Version=v4.6.2.
This error message remains same (fwk version in msg changes) even if nuget is created for the .net-standard library.
Upvotes: 0
Views: 62
Reputation: 100791
A .NET Framework project cannot use a .NET Core library. To create a library that can be used by .NET Framework and .NET Core application, the library needs to target .NET Standard. See https://learn.microsoft.com/en-us/dotnet/standard/net-standard for more information on .NET Standard.
The tooling in VS 2015 (project.json based) lets you use .NET Standard 1.5 libraries in .NET 4.6.2 projects, so if you change your library from targeting netcoreapp1.1
to netstandard1.5
, you will be able to use it both in .NET Framework 4.6.2+ and .NET Core 1.0+ projects.
Upvotes: 2