0

A csproj is referencing fo-dicom nuget package, where fo-dicom depends on fo-dicom.Desktop package (targeting netFrameowork45).

Preforming nuget restore for the project generates a warning

NU1701: Package 'fo-dicom.Desktop 4.0.8.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project

The nuspec for fo-dicom already identifies the target framework for the dependency.

<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>fo-dicom</id>
    <version>4.0.8.1</version>   
    <dependencies>
      <group targetFramework=".NETFramework4.5">
        <dependency id="fo-dicom.Desktop" version="4.0.8.1" />
      </group>
    </dependencies>
  </metadata>
</package>

The warning is only generated if nuget restore is performed using msbuild. Nuget restore from VS runs just fine. This warning in turn causes the msbuild to fail. I tried suppressing the warning but since the nuget dependency is not correctly loaded, the build fails anyway.

Why does it just occur with msbuild and not VS, and if there is a solution not to make it happen?

enter image description here

  • Hmmm on NuGet I only find `4.0.8`, but not `4.0.8.1` – mu88 Jun 14 '22 at 09:39
  • Is your project targeting netstandard? You can't (reliably) reference net framework projects from net standard ones – rbennett485 Jun 14 '22 at 17:17
  • @mu88 You're right, 4.0.8.1 is our internal version of fo-dicom. However, the result is regardless of it. – Niraj Doshi Jun 19 '22 at 12:06
  • Are the versions of NuGet in VS and CLI the same? You can also try to increase the output verbosity when building with VS. This will show you the exact commands that VS is performing and you can mimic them in the CLI – mu88 Jun 19 '22 at 17:03

0 Answers0