WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
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 >
Description of the new feature / enhancement
Background: This actually started with me wanting to update
Microsoft.DotNet.DesktopRuntime.6
x64, but WinGet would neitherwinget install --silent --id Microsoft.Dotnet.DesktopRuntime.6 --architecture x64
norwinget upgrade --all
.Scenario: I want to uninstall
Microsoft.DotNet.DesktopRuntime.6
x64, so I can upgrade it / install the newest version.I try with
--architecture
,winget install
has it, so.Hmm, maybe uninstall will prompt me for what architecture to uninstall then?
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:
Reproduce
Now try to either upgrade or uninstall just x64.
Proposed technical implementation details
Add a
--architecture
switch / parameter / option towinget uninstall
.winget install
andwinget upgrade
already have.