incorrect behavior of dotnet package
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Description
The command line help lies about the syntax for adding a nugget package. It says, the command should be:
```dotnet package add BenchmarkDotNet```
which does not work and produces an error.
You have to use
```dotnet add package BenchmarkDotNet``` instead.
### Reproduction Steps
```shell
md TestProject
cd TestProject
dotnet new console
dotnet package add BenchmarkDotNet
```
### Expected behavior
According the command line help, it should install the nugget package.
See `dotnet package -?` prints
```
Description:
Usage:
dotnet package [command] [options]
Options:
-?, -h, --help Show command line help.
Commands:
search ...
add ...
list ...
remove ...
```
### Actual behavior
Error is reported
```Could not find project or directory ``.```
### Regression?
unknown
### Known Workarounds
Disobey the command line help, and swap the command `add` with the `package` keyword:
```shell
dotnet add package BenchmarkDotNet
```
> EDIT
> or specify the project path or file (thx @baronfel):
> ```shell
> dotnet package add BenchmarkDotNet --project .
> ```
### Configuration
.net 9.0.304
Windows 11 Enterprise 23H2 (OS Build 22631.5840)
x64
### Other information
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running `dotnet package -?` and the reproduction commands in a fresh console project to compare the advertised and accepted syntax. Trace the CLI help and package-add entry point, then verify that the help matches the supported invocation and that the reproduction no longer reports a missing project or directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100