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

Include flags flow incorrectly to transitively pinned centrally managed dependencies #12274

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

Comments

@marcin-krystianc
Copy link

marcin-krystianc commented Nov 28, 2022

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

The graph flattening procedure doesn't work correctly for centrally managed transitive dependencies - in certain scenarios it includes too many assets.

https://github.com/marcin-krystianc/TestSolutions/tree/master/CpvmPrivateAssetsIssue4-IncludeFlags

App:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
    <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\Lib1\Lib1.csproj" />
  </ItemGroup>
</Project>

Lib1:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>	
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
    <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\Lib2\Lib2.csproj" IncludeAssets="Runtime" />
  </ItemGroup>
</Project>

Lib2:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
    <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
  </PropertyGroup>  
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" />
  </ItemGroup> 
</Project>

and Directory.Packages.props:

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

The expected content of centralTransitiveDependencyGroups for App project is:

"centralTransitiveDependencyGroups": {
    ".NETStandard,Version=v2.0": {
      "Newtonsoft.Json": {
        "include": "Runtime",
        "version": "[13.0.1, )"
    }
  }
}

but .NET 7.0.100 produces:

"centralTransitiveDependencyGroups": {
  ".NETStandard,Version=v2.0": {
    "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