Skip to content

Report real transitive reference versions in dotnet nuget why, not final resolved versions #13752

@rainersigwald

Description

@rainersigwald

NuGet Product(s) Affected

dotnet.exe

Current Behavior

I just tried to use dotnet nuget why to figure out why a specific package was resolved to a higher version than the one I (the owner of one of the directly referenced packages) expected. However, the version of the package I was looking at was listed as the final resolved version for every leaf.

dotnet nuget why . System.Text.Json
Project 'Microsoft.NET.Sdk' has the following dependency graph(s) for 'System.Text.Json':

  [net472]

   ├─ Microsoft.Build (v17.8.3)
   │  └─ System.Text.Json (v9.0.0-rc.2.24427.10)
   ├─ Microsoft.Deployment.DotNet.Releases (v2.0.0-preview.1.24406.1)
   │  └─ System.Text.Json (v9.0.0-rc.2.24427.10)
   ├─ Microsoft.Extensions.DependencyModel (v9.0.0-rc.2.24427.10)
   │  └─ System.Text.Json (v9.0.0-rc.2.24427.10)
   ├─ Microsoft.NET.HostModel (v9.0.0-rc.2.24427.10)
   │  └─ System.Text.Json (v9.0.0-rc.2.24427.10)
   ├─ NuGet.ProjectModel (v6.12.0-preview.1.85)
   │  └─ NuGet.DependencyResolver.Core (v6.12.0-preview.1.85)
   │     └─ NuGet.Protocol (v6.12.0-preview.1.85)
   │        └─ System.Text.Json (v9.0.0-rc.2.24427.10)
   └─ System.Text.Json (v9.0.0-rc.2.24427.10)

  [net9.0]

   ├─ Microsoft.Deployment.DotNet.Releases (v2.0.0-preview.1.24406.1)
   │  └─ System.Text.Json (v9.0.0-rc.2.24427.10)
   ├─ Microsoft.NET.HostModel (v9.0.0-rc.2.24427.10)
   │  └─ System.Text.Json (v9.0.0-rc.2.24427.10)
   └─ System.Text.Json (v9.0.0-rc.2.24427.10)

Desired Behavior

I expected something like this (reconstructed from project.assets.json info):

dotnet nuget why . System.Text.Json
Project 'Microsoft.NET.Sdk' has the following dependency graph(s) for 'System.Text.Json':

  [net472]

   ├─ Microsoft.Build (v17.8.3)
   │  └─ System.Text.Json (v7.0.3)
   ├─ Microsoft.Deployment.DotNet.Releases (v2.0.0-preview.1.24406.1)
   │  └─ System.Text.Json (v8.0.3)
   ├─ Microsoft.Extensions.DependencyModel (v9.0.0-rc.2.24427.10)
   │  └─ System.Text.Json (v9.0.0-rc.2.24427.10)
   ├─ Microsoft.NET.HostModel (v9.0.0-rc.2.24427.10)
   │  └─ System.Text.Json (v8.0.0)
   ├─ NuGet.ProjectModel (v6.12.0-preview.1.85)
   │  └─ NuGet.DependencyResolver.Core (v6.12.0-preview.1.85)
   │     └─ NuGet.Protocol (v6.12.0-preview.1.85)
   │        └─ System.Text.Json (v8.0.4)
   └─ System.Text.Json (v9.0.0-rc.2.24427.10)

  [net9.0]

   ├─ Microsoft.Deployment.DotNet.Releases (v2.0.0-preview.1.24406.1)
   │  └─ System.Text.Json (v8.0.3)
   ├─ Microsoft.NET.HostModel (v9.0.0-rc.2.24427.10)
   │  └─ System.Text.Json (v8.0.0)
   └─ System.Text.Json (v9.0.0-rc.2.24427.10)

Additional Context

I think this'd help answer the question "why is this package referenced at this version"--currently dotnet nuget why helps figure out where it came from transitively but not the versioning.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions