winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Uninstall fails when two versions have the same name, and different ID.

Open denelon opened this issue 4 years ago • 4 comments

@denelon I'm experiencing this issue when trying to uninstall a package.

> winget list --name Colorpicker
Name        Id                  Version Available Source
--------------------------------------------------------
Colorpicker Toinane.Colorpicker 2.0.0   2.0.3     winget
Colorpicker Toinane.Colorpicker 2.0.3             winget

One of those packages (the new one) was installed via an .exe downloaded from the internet, the other one was installed via winget (at least that's how I remember it, don't count on it though).

So I wanted to remove one of the packages:

> winget uninstall Colorpicker
Multiple installed packages found matching input criteria. Please refine the input.
Name              Id
--------------------------------------------------------
Colorpicker       Toinane.Colorpicker
Colorpicker 2.0.3 {2fa01720-ea93-5692-9697-66fad2caf3bf}

I totally understand why the command would fail, so I found out about the "exact" flag and tried that:

winget uninstall -e Toinane.Colorpicker
Multiple installed packages found matching input criteria. Please refine the input.
Name              Id
--------------------------------------------------------
Colorpicker       Toinane.Colorpicker
Colorpicker 2.0.3 {2fa01720-ea93-5692-9697-66fad2caf3bf}

The ids are clearly not the same, why is this failing? I'm also confused as to why the winget list also returns two packages, but both have the same id.

I also reported the issue here: https://github.com/microsoft/winget-cli/issues/282#issuecomment-925848555, but I assume it's the wrong issue as that is specifically about installing powershell.

In case you are wondering about the version:

> winget -v
v1.1.12663

Originally posted by @Elias-Graf in https://github.com/microsoft/winget-cli/issues/1083#issuecomment-948665717

denelon avatar Oct 21 '21 14:10 denelon

winget -v
v1.1.12663

I have also run into this issue. Caused for me by having the package installed at the machine level via executable installer, then upgrading the package with winget, which defaulted to installing the new package at the user level. I would have expected winget to check what level the package was installed at and match that when doing the upgrade.

Uninstall Failure

I tried using the -e, --id and --name flags for the uninstall of the older package, but none of them worked.

Workaround

The workaround for the issue was to go to Apps and Features in Windows and uninstall the older version there.

Possible UI improvement

It might be a good idea to show in a separate column in the output how the package was installed, at the machine or user level. Then at least it would be more immediately obvious to the user where the problem lies before doing a web search about the issue.

This column would also be good to have with winget list from a security point of view in case the user accidentally installed a package at the machine level in error.

Infineight avatar Nov 10 '21 10:11 Infineight

I have a similar (probably the same) problem.

winget upgrade shows me an upgdare for Microsoft .NET SDK, When I call winget upgrade "Microsoft .NET SDK" I see the following result:

PS C:\Windows\system32> winget upgrade -q "Microsoft .NET SDK"
Multiple installed packages found matching input criteria. Please refine the input.
Name                             Id
-----------------------------------------------------------------------
Microsoft .NET SDK               Microsoft.dotnet
Microsoft .NET SDK 5.0.403 (x64) {81aba691-7919-4e81-9d4a-e5df954b0b1d}
Microsoft .NET SDK 5.0.303 (x64) {b447173e-28f0-40ae-b0c8-15b9c0a1ad4b}
PS C:\Windows\system32>

So, I call it again with winget upgrade -e "Microsoft .NET SDK" but get the same result. Although all 3 installations have different names and also different ids. The test with --id also didn't work, with or without -e.

DrPepperBianco avatar Nov 24 '21 10:11 DrPepperBianco

Oh, by the way, if you have already the newest version of dotnet installed (or any other program of course) and also a specific version, winget should not show the specific version as being able to be upgraded. It would probably be useful to hide certain installation from upgrade completely. Just a thought.

DrPepperBianco avatar Nov 24 '21 10:11 DrPepperBianco

We've been working on the side-by-side scenarios. You could try the latest release and enable the experimental feature on:

  • https://github.com/microsoft/winget-cli/releases/tag/v1.8.924-preview

Please provide feedback at:

  • https://github.com/microsoft/winget-cli/discussions/4281

denelon avatar Apr 02 '24 19:04 denelon