I am trying to reference a nuget package which is clearly .NetStandard2.0
. We own the source code for this package and written it to target .netstandard. We do have a CI pipeline so that when we push this code, it builds and releases the nuget package. When I try to reference the resulting nuget package into my current .netCore application, i get following error:
was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
That does not make any sense to me. So far I have tried following debugging steps:
dotpeek
to make sure that it in fact is a .netstandard package and it is. Not sure what makes it think that it was targeting at any point. below is how my .csproj configuration looks like
<TargetFramework>netstandard2.0</TargetFramework>
Not sure if any other config block matters here but let me know if you need more info on this. Any ideas?
I ran in to a similar issue where I was publishing my own NetStandard2.0 package via Azure Artifacts and then attempting to consume it in a netcore application.
It turned out that the problem was that I had named my package the same as an existing NuGet package. My Azure Artifacts nuget feed was configured correctly in Visual Studio, but when it attempts to install the package it tries the default NuGet feed first and picks up the other one (which happened to be NetFramework only) rather than mine.
Once I renamed my package to be unique (I just added my own namespace) and re-published it all worked properly.
I guess that might not be the issue for everyone but it was for me.