Target necessary frameworks in order to support mixed project types

asp.net-core c# entity-framework-core

Question

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?

1
0
8/24/2018 12:37:51 AM

Accepted Answer

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.

0
8/24/2018 1:36:29 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow