If a package reference with PrivateAssets=all has transitive dependencies and the project targets netstandard2.0, the transitive dependency is packed from the ref (reference assembly) folder instead of the lib folder, making the reference unusable at run-time.
Repro:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>TransitiveRef</PackageId>
<Description>TransitiveRef</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGetizer" Version="0.5.0" />
<PackageReference Include="Scriban" Version="3.0.4" PrivateAssets="all" />
</ItemGroup>
</Project>
Package contents seems to be correct:
❯ nugetize
Package: TransitiveRef.1.0.0.nupkg
C:\Temp\bin\TransitiveRef.nuspec
Authors : TransitiveRef
Description: TransitiveRef
Version : 1.0.0
Contents:
/lib/
netstandard2.0/
Microsoft.CSharp.dll
Scriban.dll
System.Runtime.CompilerServices.Unsafe.dll
System.Threading.Tasks.Extensions.dll
TransitiveRef.dll
TransitiveRef.pdb
However, opening the System.Runtime.CompilerServices.Unsafe.dll assembly reveals it to be a reference assembly with no implementations.
If a package reference with
PrivateAssets=allhas transitive dependencies and the project targetsnetstandard2.0, the transitive dependency is packed from theref(reference assembly) folder instead of thelibfolder, making the reference unusable at run-time.Repro:
Package contents seems to be correct:
However, opening the System.Runtime.CompilerServices.Unsafe.dll assembly reveals it to be a reference assembly with no implementations.