Provided by: dotnet-host-10.0_10.0.1-0ubuntu1_amd64 

dotnet nuget why
This article applies to: ✔️ .NET 8.0.4xx SDK and later versions
NAME
dotnet-nuget-why - Shows the dependency graph for a particular package.
SYNOPSIS
dotnet nuget why [<PROJECT|SOLUTION>] <PACKAGE> [-f|--framework <FRAMEWORK>]
dotnet nuget why -h|--help
DESCRIPTION
The dotnet nuget why command shows the dependency graph for a particular package for a given project or
solution.
Starting with version 9.0.200, the command introduces support for runtime identifier (RID) specific pack‐
ages by generating separate dependency trees for each RID and framework combination. For example, if a
project targets net9.0 with the win-x64 RID, the command generates trees for net9.0/win-x64 and net9.0.
Older project format
To use the command with projects that can’t be restored with the .NET SDK, you can pass a NuGet assets
file in place of the project file (starting with the .NET 9 SDK):
1. First, restore the project in Visual Studio or using msbuild.exe. By default, the assets file is in
the project’s obj\ directory, but you can find the location with msbuild.exe path\to\project.proj
-getProperty:ProjectAssetsFile.
2. Run dotnet nuget why path\to\project.assets.json SomePackage.
ARGUMENTS
• PROJECT|SOLUTION
The project or solution file to operate on. If a directory is specified, the command searches the di‐
rectory for a project or solution file. If more than one project or solution is found, an error is
thrown. If no value is provided, the current working directory is used by default.
• PACKAGE
The package name to look up in the dependency graph.
OPTIONS
• -f|--framework <FRAMEWORK>
The target framework(s) for which dependency graphs are shown. You can pass multiple --framework op‐
tions to see graphs for more than one framework.
• -?|-h|--help
Prints out a description of how to use the command.
EXAMPLES
• Show the dependency graph for the package “System.Text.Json”:
dotnet nuget why System.Text.Json
[IMAGE: Example: Solution with multiple projects]
• Show the dependency graph for the package “System.Text.Json” for a specific project:
dotnet nuget why path/to/DotnetNuGetWhyPackage.csproj System.Text.Json
• Show the dependency graph for a specific target framework:
dotnet nuget why System.Text.Json --framework net6.0
2025-10-30 dotnet-nuget-why(1)