I am currently using asp.net-core 2.1 with several .net-core 2.1 libraries. Two of the projects are based on an ef-core 2.1 library and a model library. I now need to develop a Windows service that references both of those projects, I assumed I could simply switch them to netstandard 2.0.
According to Package Microsoft.AspNetCore.All 2.1.0 is not compatible with netcoreapp2.0, this is possible, however I have the following set in the asp.net core project (using sdk 2.1.400):
<TargetFramework>netcoreapp2.1</TargetFramework>
but it fails to compile with:
NU1202 Package Microsoft.AspNetCore.App 2.1.0 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Microsoft.AspNetCore.App 2.1.0 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1)
Anyone know how I can leverage the ef core and model libs in a Windows service?
Copied from the comment.
Most ASP.NET Core packages are .NET Standard 2.0 compliant, but the meta package Microsoft.AspNetCore.App
is not.
So to re-target your two projects to .NET Standard 2.0, you need to remove the package reference to .App
, and use references to the individual packages instead, like you discovered.