logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

This article applies to: ✔️ .NET 8.0.4xx SDK and later versions

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.

       • PACKAGE

         The package name to look up in the dependency graph.

Description

       The  dotnetnugetwhy command shows the dependency graph for a particular package for a given project or
       solution.

       Starting from the .NET 9 SDK, it’s possible to pass a NuGet assets file in place of the project file,  in
       order  to  use  the  command  with projects that can’t be restored with the .NET SDK.  First, restore the
       project in Visual Studio, or msbuild.exe.  By default the assets file is in the project’s obj\ directory,
       but you can find the location with msbuild.exepath\to\project.proj-getProperty:ProjectAssetsFile.   Fi‐
       nally, run dotnetnugetwhypath\to\project.assets.jsonSomePackage.

Dotnet Nuget Why

Thisarticleappliesto: ✔️ .NET 8.0.4xx SDK and later versions

Examples

       • Show the dependency graph for the package “System.Text.Json” for a given solution:

                dotnet nuget why .\DotnetNuGetWhyPackage.sln System.Text.Json

         [IMAGE: Example: Solution with multiple projects]

       • Show the dependency graph for the package “System.Text.Json” for a single project:

                dotnet nuget why .\DotnetNuGetWhyPackage.csproj System.Text.Json

       • Show the dependency graph for a specific target framework:

                dotnet nuget why .\DotnetNuGetWhyPackage.csproj System.Text.Json --framework net6.0

                                                   2024-10-02                                dotnet-nuget-why(1)

Name

       dotnet-nuget-why - Shows the dependency graph for a particular package.

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.

Synopsis

              dotnet nuget why <PROJECT|SOLUTION> <PACKAGE> [-f|--framework <FRAMEWORK>]

              dotnet nuget why -h|--help

See Also