Skip to content

Commit

Permalink
Add docs for the 'dotnet nuget why' command (#41472)
Browse files Browse the repository at this point in the history
  • Loading branch information
advay26 committed Jun 19, 2024
1 parent 287d9d1 commit c1bf9bf
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
65 changes: 65 additions & 0 deletions docs/core/tools/dotnet-nuget-why.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: dotnet nuget why command
description: Shows the dependency graph for a particular package for a given project or solution.
author: advay26
ms.date: 05/30/2024
---
# 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

```dotnetcli
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.

## Arguments

- **`PROJECT|SOLUTION`**

The project or solution file to operate on. If a directory is specified, the command searches the directory 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.

## Options

- **`-f|--framework <FRAMEWORK>`**

The target framework(s) for which dependency graphs are shown. You can pass multiple `--framework` options to see graphs for more than one framework.

[!INCLUDE [help](../../../includes/cli-help.md)]

## Examples

- Show the dependency graph for the package "System.Text.Json" for a given solution:

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

![Example: Solution with multiple projects](media/dotnet-nuget-why/dotnet-nuget-why-solution-with-multiple-projects.png)

- Show the dependency graph for the package "System.Text.Json" for a single project:

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

- Show the dependency graph for a specific target framework:

```dotnetcli
dotnet nuget why .\DotnetNuGetWhyPackage.csproj System.Text.Json --framework net6.0
```
1 change: 1 addition & 0 deletions docs/core/tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ The following commands are installed by default:
- [`nuget trust`](dotnet-nuget-trust.md) (Available since .NET 5 SDK)
- [`nuget sign`](dotnet-nuget-sign.md) (Available since .NET 6 SDK)
- [`package search`](dotnet-package-search.md) (Available since .NET 8.0.2xx SDK)
- [`nuget why`](dotnet-nuget-why.md) (Available since .NET 8.0.4xx SDK)

### Workload management commands

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/navigate/tools-diagnostics/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ items:
href: ../../core/tools/dotnet-nuget-trust.md
- name: dotnet nuget sign
href: ../../core/tools/dotnet-nuget-sign.md
- name: dotnet nuget why
href: ../../core/tools/dotnet-nuget-why.md
- name: dotnet pack
href: ../../core/tools/dotnet-pack.md
- name: dotnet package search
Expand Down

0 comments on commit c1bf9bf

Please sign in to comment.