microsoft / microsoft/winget-cli

winget uninstall with --version uninstalls the wrong version

Open
#3,453 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Command-Uninstall Issue-Bug
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

When there are two installations of the same application (different versions), running winget uninstall and specifying --version, the wrong version of the application may be uninstalled, leaving the target version intact.

Personal case:

> winget list --name code --verbose
Name                                Id                         Version Available Source
---------------------------------------------------------------------------------------
Microsoft Visual Studio Code        Microsoft.VisualStudioCode 1.74.2  1.80.1    winget
Microsoft Visual Studio Code (User) Microsoft.VisualStudioCode 1.80.1            winget
> winget uninstall --id Microsoft.VisualStudioCode --version 1.74.2
Found Microsoft Visual Studio Code [Microsoft.VisualStudioCode]
Starting package uninstall...
Successfully uninstalled
> winget list --name code --verbose
Name                         Id                         Version Available Source
--------------------------------------------------------------------------------
Microsoft Visual Studio Code Microsoft.VisualStudioCode 1.74.2  1.80.1    winget
Steps to reproduce

Install the same application twice:

  • Microsoft.VisualStudioCode v1.74.2 on system account
  • Microsoft.VisualStudioCode v1.80.1 on user account

Run winget uninstall --id Microsoft.VisualStudioCode --version 1.74.2

Expected behavior

Expected v1.74.2 to be uninstalled and v1.80.1 to remain installed.

Actual behavior

Observed that v1.74.2 was not uninstalled and v1.80.1 was uninstalled inadvertently.

Environment
> winget --info
Windows Package Manager v1.5.1572
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19044.3208
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.20.1572.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with two Microsoft.VisualStudioCode installations, v1.74.2 on the system account and v1.80.1 on the user account, then run the stated winget uninstall command. Trace how the CLI selects an installed package when --id and --version are supplied; done means only v1.74.2 is removed and v1.80.1 remains.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.