dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.68k stars 1.06k forks source link

`dotnet tool install` needs a `--force` switch #33246

Open heaths opened 1 year ago

heaths commented 1 year ago

Is your feature request related to a problem? Please describe.

dotnet tool install really needs a --force switch to say "do it regardless of what's installed.

Despite the old thread about this, separate install and update commands for dotnet tool aren't useful on CI agents where a particular version - or none - are installed. As a pipeline author, you always have to either scaffold and manage a .config/dotnet-tools.json file - particular problematic in a monorepo - or have your pipeline conditionally run dotnet tool install or dotnet tool update in case an older version (or even newer) is present. This is a huge burden when getting and keeping pipelines working is one of the hardest duties in modern development (no practical dev loop rather than try and try again).

Describe the solution you'd like

dotnet tool install --force should install whatever version (or latest) you specify regardless of whether a tool is installed.

Additional context

See thread for more context. A dotnet tool upgrade does not sufficiently supersede dotnet tool install --force.

JL03-Yue commented 11 months ago

35088 Aim to address this scenario