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

Add docs for the 'dotnet nuget why' command #41472

Merged
merged 6 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@advay26 This version looks wrong, I think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Youssef1313 We have a bug where it's not showing up in dotnet nuget --help, because of an incomplete transition to a different CLI parsing library:

but if you run dotnet nuget why anyway, you'll see why's help (after error messages talking about missing required arguments)

Otherwise, please explain why you think it's the wrong version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't work for me with .NET 9 SDK Preview 4 but worked with preview 6.

Copy link
Member

@zivkan zivkan Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.NET 9 P4 came out in May, whereas 8.0.400 and .NET 9 P6 came out in July. 8.0.400 isn't out yet. Basically, it's a new feature.

I'll leave it up to the .NET team to decide if they want to update the docs to mention which pre-release version of .NET 9 the feature is available. My opinion is that once .NET 9 goes GA, it won't be relevant any longer and the NuGet team at least doesn't have dedicated docs writer resources to help us keep docs up to date.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. I agree the exact preview isn't very relevant.


## 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`**

A path to a project file, solution file, or directory. 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.
tdykstra marked this conversation as resolved.
Show resolved Hide resolved

- **`PACKAGE`**

The package name to lookup in the dependency graph.
tdykstra marked this conversation as resolved.
Show resolved Hide resolved

## 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 @@ -60,6 +60,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.
Loading