-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Avoid reinstall tool already installed #41746
Avoid reinstall tool already installed #41746
Conversation
@dotnet-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good to me—thanks! The only thing I'm wondering at the moment is what its behavior is if you have a broken tool package; is there a way to repair it?
test/dotnet.Tests/CommandTests/ToolInstallGlobalOrToolPathCommandTests.cs
Outdated
Show resolved
Hide resolved
src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
Show resolved
Hide resolved
src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
Outdated
Show resolved
Hide resolved
…andTests.cs Co-authored-by: Forgind <[email protected]>
Probably only uninstalling and installing again. Is there any way to know if a package is broken in execution time? |
It probably depends on the tool. My PM suggested --force; can you make sure that if you try to install the version you already have and specify --force, that it still does the install? |
I can be wrong but I think dotnet tools doesn't support I couldn't find |
Since we're tracking --force, I think I'm happy with this. @nagilson, do you want to review before we merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks great to me, you did a great job adding tests and adapting to the existing code base. Thank you for your contribution! :)
btw, the pipeline failures here are not your fault, it is this annoying issue that has been going on, we will try to take care of it. |
/azp run |
Supported commands
See additional documentation. |
Azure Pipelines successfully started running 4 pipeline(s). |
Thank you! I liked to contribute and you will see me more times here 😊 |
@caiogranero |
Fixes #40818
Context
Following the changes introduced in #37311, the
dotnet tool install --global
command began reinstalling tools that were already installed, which involved deleting and then adding the same tool version again. Before this release, it was not possible to install a version that was already installed.This behavior change was reported in #40818. I propose a modification to avoid reinstalling tools that are already installed.
Change
The current installation flow involves uninstalling all matching tools and then installing them again. My change modifies this flow by first checking if the requested best match package version is already installed. If it is, the flow is stopped, and a message is printed: 'Tool '{0}' is already installed'.