1

I have a .net472 framework library which I want to call from a netcoreapp2.1 api. Because I use the library in many projects I made my own nuget feed for it. The feed works when I use it to install packages into my other .net472 applications.

However when I try to install it into my .netcoreapp2.1 api I get an error When I try to install using Nuget I get

NU1202 Package SBD.Common 2.0.0-CI-20190830-212056 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package SBD.Common 2.0.0-CI-20190830-212056 supports: net472 (.NETFramework,Version=v4.7.2) ApiForMe C:\dev\MyApi\MyApi.csproj

I tried clearing the Nuget Cache as show here but it did not help.

My .net472 class library has a dependency on Entity Framework 6.2

Kirsten
  • 15,730
  • 41
  • 179
  • 318
  • https://stackoverflow.com/questions/46037274/fix-for-package-xxx-is-not-compatible-with-netcoreapp2-0-netcoreapp-version-v – Kirsten Aug 30 '19 at 23:28
  • https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1202 – Kirsten Aug 30 '19 at 23:41
  • https://stackoverflow.com/questions/50920635/re-target-net-core-to-net471-net-472 – Kirsten Aug 30 '19 at 23:44
  • You cannot. https://blog.lextudio.com/which-class-library-project-to-go-in-visual-studio-2015-2017-a48710cf3dff – Lex Li Aug 31 '19 at 02:05
  • @LexLi so If I convertend my api to .netstandard it would be able to call .net472 library? – Kirsten Sep 01 '19 at 04:33
  • 2
    You might switch to .NET Standard, but a common practice is to use multi targeting, https://blog.lextudio.com/tips-for-net-nuget-package-authors-august-2017-48f07604e4a0 – Lex Li Sep 01 '19 at 05:50
  • Does your class library have any dependencies? – GlennSills Sep 01 '19 at 22:16
  • Thank you @GlennSills I updated the question to show there is a dependency on Entity Framework. – Kirsten Sep 02 '19 at 02:25
  • 1
    @KirstenGreed Maybe that's your problem. Just looking at nuget.org it doesn't look like EntityFramework 6.2 supports netcoreapp2.1. At least it is not marked as supporting netstandard2.0. You might want to try rebuilding with the latest preview version but this is a wild guess. – GlennSills Sep 02 '19 at 15:02

1 Answers1

-1

install other version .net core sdk .Some package use low version .net core sdk.You can check with version with folder:C:\Program Files\dotnet\shared\Microsoft.NETCore.App