I am trying to reference from a .NET Core 3.1 project, a NuGet package that targets only net40
via the NuGet compatibility shim. The package is added to my project, however the net40
dependencies are not.
The package is structured as:
lib\
net40\
AssemblyA.dll
nuspec:
<dependencies>
<group targetFramework="net40">
<dependency id="PackageB" version="1.0" />
</group>
</dependencies>
Visual Studio's Package Manager lists the dependencies, but when installed, the dependencies are not listed by VS' Preview Changes window and are indeed not installed. PackageB
also targets net40
.
It does work if I:
- Include the dependencies in an "Any" (blank) dependency group as well as under
net40
- Remove the
net40
dependency group and list the package directly under<dependencies>
as a flat list - Remove the
net40
underlib\
and use a flat list
These are not ideal as it obfuscates the true nature of the targets frameworks. The last two produce NU5128
on pack
. For future reference, I should mention that it's required to remove the dependencies from the local cache for even these scenarios to work (surely a bug?).
Any ideas on how to pull dependencies from such packages? Is this simply not supported? A good test example of this is the "Polly.Net40Async" package.
(VS: 16.6.5, dotnet: 3.1.302, PackageReference, Windows 10)