microsoft / microsoft/winget-cli

Uninstall needs the ability to specify `--architecture`

Open
#4,810 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of the new feature / enhancement

Background: This actually started with me wanting to update Microsoft.DotNet.DesktopRuntime.6 x64, but WinGet would neither winget install --silent --id Microsoft.Dotnet.DesktopRuntime.6 --architecture x64 nor winget upgrade --all.

Scenario: I want to uninstall Microsoft.DotNet.DesktopRuntime.6 x64, so I can upgrade it / install the newest version.

PS > winget list Microsoft.DotNet

Name                                                   Id                                         Version Available Source
--------------------------------------------------------------------------------------------------------------------------
Microsoft ASP.NET Core 7.0.20 - Shared Framework (x64) Microsoft.DotNet.AspNetCore.7              7.0.20            winget
Microsoft Windows Desktop Runtime - 6.0.33 (x86)       Microsoft.DotNet.DesktopRuntime.6          6.0.33            winget
Microsoft Windows Desktop Runtime - 6.0.31 (x64)       Microsoft.DotNet.DesktopRuntime.6          6.0.31            winget
Microsoft Windows Desktop Runtime - 7.0.20 (x64)       Microsoft.DotNet.DesktopRuntime.7          7.0.20            winget
Microsoft Windows Desktop Runtime - 8.0.8 (x64)        Microsoft.DotNet.DesktopRuntime.8          8.0.8             winget
Microsoft .NET Framework 4.8.1 SDK                     Microsoft.DotNet.Framework.DeveloperPack_4 4.8.1             winget
Microsoft .NET SDK 8.0.206 (x64)                       Microsoft.DotNet.SDK.8                     8.0.206 8.0.401   winget
Microsoft .NET SDK 8.0.304 (x64)                       Microsoft.DotNet.SDK.8                     8.0.304           winget

PS >

I try with --architecture, winget install has it, so.

PS > winget uninstall --silent --id Microsoft.DotNet.DesktopRuntime.6 --architecture x64

Windows Package Manager v1.8.1911
Copyright (c) Microsoft Corporation. All rights reserved.

Argument name was not recognized for the current command: '--architecture'

Uninstalls the selected package, either found by searching the installed packages list or directly from a manifest. By default, the query must case-insensitively match the id, name, or moniker of the package. Other fields can be used by passing their appropriate option.

usage: winget uninstall [[-q] <query>...] [<options>]

The following command aliases are available:
  remove
  rm

The following arguments are available:
  -q,--query                  The query used to search for a package

The following options are available:
  -m,--manifest               The path to the manifest of the package
  --id                        Filter results by id
  --name                      Filter results by name
  --moniker                   Filter results by moniker
  --product-code              Filters using the product code
  -v,--version                The version to act upon
  --all,--all-versions        Uninstall all versions
  -s,--source                 Find package using the specified source
  -e,--exact                  Find package using exact match
  --scope                     Select installed package scope filter (user or machine)
  -i,--interactive            Request interactive installation; user input may be needed
  -h,--silent                 Request silent installation
  --force                     Direct run the command and continue with non security related issues
  --purge                     Deletes all files and directories in the package directory (portable)
  --preserve                  Retains all files and directories created by the package (portable)
  -o,--log                    Log location (if supported)
  --header                    Optional Windows-Package-Manager REST source HTTP header
  --authentication-mode       Specify authentication window preference (silent, silentPreferred or interactive)
  --authentication-account    Specify the account to be used for authentication
  --accept-source-agreements  Accept all source agreements during source operations
  -?,--help                   Shows help about the selected command
  --wait                      Prompts the user to press any key before exiting
  --logs,--open-logs          Open the default logs location
  --verbose,--verbose-logs    Enables verbose logging for winget
  --nowarn,--ignore-warnings  Suppresses warning outputs
  --disable-interactivity     Disable interactive prompts
  --proxy                     Set a proxy to use for this execution
  --no-proxy                  Disable the use of proxy for this execution

More help can be found at: https://aka.ms/winget-command-uninstall

PS >

Hmm, maybe uninstall will prompt me for what architecture to uninstall then?

PS > winget uninstall --silent --id Microsoft.DotNet.DesktopRuntime.6

Multiple versions of this package are installed. Either refine the search, pass the `--version` argument to select one, or pass the `--all-versions` flag to uninstall all of them.

PS >

In my case I could use version, as x86 and x64 are different versions. But they could in theory be the same version.

I ended up doing:

PS > winget uninstall --silent --id Microsoft.DotNet.DesktopRuntime.6 --all-versions

(1/2) Found Microsoft Windows Desktop Runtime - 6.0.33 (x86) [Microsoft.DotNet.DesktopRuntime.6]
Starting package uninstall...
Successfully uninstalled

(2/2) Found Microsoft Windows Desktop Runtime - 6.0.31 (x64) [Microsoft.DotNet.DesktopRuntime.6]
Starting package uninstall...
Successfully uninstalled

PS >
Reproduce
PS > winget install --silent --id Microsoft.DotNet.DesktopRuntime.6 --version 6.0.31 --architecture x64
Installs successfully.

PS > winget install --silent --id Microsoft.DotNet.DesktopRuntime.6 --version 6.0.33 --architecture x86
Installs successfully.

Now try to either upgrade or uninstall just x64.

Proposed technical implementation details

Add a --architecture switch / parameter / option to winget uninstall.

  • Like winget install and winget upgrade already have.

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

Start with the uninstall command's option handling and compare how the existing install and upgrade commands implement --architecture. Reproduce the two Microsoft.DotNet.DesktopRuntime.6 installations, then verify that uninstalling with --architecture x64 selects only the x64 package while leaving the x86 package installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.