0
votes

I am trying to understand why the warning happens.

Steps

  1. Open Visual Studio 2019
  2. Create new .NET Core class library. This is created with target framework .NET Core 2.1.
  3. Add nuget package GuerrillaSharp
  4. Build project

Expected result

No issues or warnings.

Actual result

Warning NU1701
Package 'GuerrillaSharp 1.0.0' 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.

What I checked

I have found similar issues on Google/Stack Overflow, but don't see how this explains this nuget package situation. In many other posts the solution was often to install a newer version of the nuget package.

GuerillaSharp dependencies:

  • Newtonsoft.Json (>= 11.0.2), which supports .NET Standard 1.0, 1.3 and 2.0. So in my understanding, this should be compatible with .NET Core 2.1.
1

1 Answers

2
votes

GuerillaSharp only has net461 binaries. There are many ways to check, but one way is to view the package on fuget.org. net461 is not "directly" compatible with netcoreapp2.1, but because so many package authors did not update their packages to support netstandard, the NuGet and .NET SDK teams added asset target fallback which basically says "well, net461 APIs are close to netstandard, so let's pretend it's compatible even though it might not be". That's why you're getting the warning. It might work, but if GuerillaSharp is using any .NET Framework-only APIs, it will crash at runtime.