Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrivateAssets for central transitive dependencies should flow regardless whether the parent is a project or a package #12276

Closed
marcin-krystianc opened this issue Nov 29, 2022 · 0 comments · Fixed by NuGet/NuGet.Client#4952
Labels
Area:RestoreCPM Central package management Priority:2 Issues for the current backlog. Type:Bug
Milestone

Comments

@marcin-krystianc
Copy link

NuGet Product Used

dotnet.exe

Product Version

7.0.100

Worked before?

no

Impact

It bothers me. A fix would be nice

Repro Steps & Context

When calculating the effective PrivateAssets value for a library that is centrally managed and pinned transitively, the PrivateAssets on project nodes are ignored but they shouldn't be.

Project1:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
    <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Project2\Project2.csproj" PrivateAssets="All" />
  </ItemGroup>
</Project>

Project2:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>	
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
    <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" />
  </ItemGroup>
</Project>

Directory.Packages.props:

<Project>
    <ItemGroup>
        <PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
    </ItemGroup>
</Project>

expected empty centralTransitiveDependencyGroups but got:

  "centralTransitiveDependencyGroups": {
    ".NETFramework,Version=v4.6": {
      "Newtonsoft.Json": {
        "include": "Runtime, Compile, Native, BuildTransitive",
        "suppressParent": "None",
        "version": "[13.0.1, )"
      }
    }
  }

Verbose Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:RestoreCPM Central package management Priority:2 Issues for the current backlog. Type:Bug
Projects
None yet
3 participants