Skip to content

When packing transitive dependencies for PrivateAssets=all, pack lib, not ref #36

@kzu

Description

@kzu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions