[cli] install exact version of a package
Is your feature request related to a problem? Please describe.
I can not downgrade a package automatically (or easily)
Describe the solution you'd like
Example: dotnet tool install --tool-path ~/.dotnet/tools Boogie --version 2.9.12 --exact
for example add an exact flag, make dotnet tool uninstall boogie if the one installed is not exactly 2.9.12, and not install anything if there is not this version
Additional context
Add any other context or screenshots about the feature request here.
Ah, I think I see what you mean here - when I try a similar command locally, I get the following warning:
08:59:12 ❯ dotnet tool install Boogie --version 2.9.12
C:\Users\chusk\AppData\Local\Temp\leocx00m.zis\restore.csproj : warning NU1603: restore depends on Boogie (>= 2.9.12) but Boogie 2.9.12 was not found. An approximate best match of Boogie 2.10.0 was resolved.
You can invoke the tool from this directory using the following commands: 'dotnet tool run boogie' or 'dotnet boogie'.
Tool 'boogie' (version '2.10.0') was successfully installed. Entry is added to the manifest file D:\Code\Scratch\standup\.config\dotnet-tools.json.
So we see that 2.10.0 was installed instead. This is possibly a side effect of us using a nuget restore as the mechanism to get the actual tool. In .NET 8 we hope to change this to download directly through the NuGet APIs, so we have more precise control over the experience here and could error if the requested version wasn't found. I would expect --exact to be implied when a specific version is provided, so I don't know that we need a new flag for it.
@baronfel Jiangying said we're good to close this issue and I agree, but do we have an issue for that .NET 8 change with the NuGet APIs? I don't see that tracked anywhere