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

dotnet nuget why shouldn't require project when there is only one in the current directory #13553

Closed
zivkan opened this issue Jun 17, 2024 · 3 comments · Fixed by NuGet/NuGet.Client#5969
Assignees
Labels
Functionality:Why dotnet nuget why Priority:2 Issues for the current backlog. Product:dotnet.exe Type:Bug

Comments

@zivkan
Copy link
Member

zivkan commented Jun 17, 2024

NuGet Product Used

dotnet.exe

Product Version

.NET 9 SDK daily preview

Worked before?

no, new feature

Impact

It bothers me. A fix would be nice

Repro Steps & Context

When the current directory contains only a single project file, commands like dotnet restore, dotnet build, dotnet add package, dotnet list package, and so on, all use the project file implicitly.

dotnet nuget why not only doesn't implicitly use the project file, but outputs an error message twice

> dotnet nuget why Azure.Identity
Required argument missing for command: 'why'.

Required argument missing for command: 'why'.

Description:
  Shows the dependency graph for a particular package for a given project or solution.

Usage:
  nuget why <PROJECT|SOLUTION> <PACKAGE> [options]

Arguments:
  <PROJECT|SOLUTION>  A path to a project, solution file, or directory.
  <PACKAGE>           The package name to lookup in the dependency graph.

Options:
  -f, --framework  The target framework(s) for which dependency graphs are shown.
  -?, -h, --help   Show help and usage information

Compare this to dotnet add package -h which has:

Usage:
  dotnet add [<PROJECT>] package <PACKAGE_NAME> [options]

Arguments:
  <PROJECT>       The project file to operate on. If a file is not specified, the command will search the current directory for one. [default:
                  C:\src\myrepo\]

Verbose Logs

No response

@jeffkl jeffkl added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Functionality:Why dotnet nuget why Priority:2 Issues for the current backlog. and removed Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. labels Jun 17, 2024
@egvijayanand
Copy link

I agree with this. It aligns with the other dotnet commands, that look for a project file in the current folder if nothing is mentioned.

If implemented, this will provide a consistent UX.

@baronfel
Copy link

+1 here from the dotnet CLI team - the CLI already has an existing semantic of "if a project is required and none is specified, probe for one in the CWD, erroring if there are multiple possible project-like things". Users really hate it when this convention isn't uniformly applied across tools that ship in the SDK or feel like they ship in the SDK. This is one of the most common pain points reported in the ongoing dotnet CLI survey.

@ajpinedam
Copy link

I came to report this. It's so lovely to see it was already reported and fixed. Thanks @zivkan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Why dotnet nuget why Priority:2 Issues for the current backlog. Product:dotnet.exe Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants