microsoft / microsoft/winget-cli

Old Winget Version Files Exist

Open
#5,277 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-External 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

Disclosure: just started using winget to mass update devices

I've been using--rightly or wrongly--the following command to upgrade winget:

Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod

I researched and understand now the proper way is just to use winget itself (if on v1.6 or later)

winget upgrade winget --scope machine

After the latest release update today, 1.25.340.0 (1.10.340), if I look in my Program Files, I see an older version folder still exist (1.25.320.0)

When I run get-appxpackage -AllUsers | ? {$_.PackageFamilyName -like '*desktopappinstaller*'}, I only see one version installed

Name : Microsoft.DesktopAppInstaller
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1.25.340.0
PackageFullName : Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
PackageUserInformation : {S-1-5-21-414354371-3978168809-1405386919-6183
[S-1-5-21-414354371-3978168809-1405386919-6183]: Installed,
S-1-5-21-3636777555-3620466540-2059802385-1000
[S-1-5-21-3636777555-3620466540-2059802385-1000]: Staged,
S-1-5-21-3636777555-3620466540-2059802385-1001
[S-1-5-21-3636777555-3620466540-2059802385-1001]: Staged,
S-1-5-21-414354371-3978168809-1405386919-6184
[S-1-5-21-414354371-3978168809-1405386919-6184]: Installed}
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : True
Dependencies : {Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64__8wekyb3d8bbwe,
Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64__8wekyb3d8bbwe,
Microsoft.DesktopAppInstaller_1.25.340.0_neutral_split.scale-150_8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok

I tried running
winget remove winget --scope machine --uninstall-previous
winget remove winget --scope machine
winget remove winget

And old folder still exists

PS C:\Program Files\WindowsApps> get-childitem | ? {$_.name -like 'microsoft.desktopappinstaller'}

Directory: C:\Program Files\WindowsApps

Mode LastWriteTime Length Name


d---- 2/26/2025 10:53 AM Microsoft.DesktopAppInstaller_1.25.320.0_neutral_split.scale-100_8wekyb3d8bbwe
d---- 2/28/2025 9:21 AM Microsoft.DesktopAppInstaller_1.25.320.0_neutral_split.scale-150_8wekyb3d8bbwe
d---- 2/28/2025 9:21 AM Microsoft.DesktopAppInstaller_1.25.320.0_x64__8wekyb3d8bbwe
d---- 3/4/2025 9:30 AM Microsoft.DesktopAppInstaller_1.25.340.0_neutral_split.scale-100_8wekyb3d8bbwe
d---- 3/4/2025 9:30 AM Microsoft.DesktopAppInstaller_1.25.340.0_neutral_split.scale-150_8wekyb3d8bbwe
d---- 3/4/2025 9:30 AM Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe
d---- 2/28/2025 9:21 AM Microsoft.DesktopAppInstaller_2025.221.7.0_neutral_8wekyb3d8bbwe
d---- 3/4/2025 9:30 AM Microsoft.DesktopAppInstaller_2025.228.315.0_neutral
_8wekyb3d8bbwe

Steps to reproduce

Have winget v. 1.10.320 installed, and then run the Cim-Instance command from above

Expected behavior

Expect only the latest version of winget files to exist, i.e., one folder in Program Files instead of two. Problem here is when using scripts to check for the winget.exe path, two paths come up, instead of one.

I can account for this by checking the most recent last modified/write time, but don't think two folders should exist.

Actual behavior

Two folders exist instead of one, the latest winget version folder

Environment
PS C:\Program Files\WindowsApps> winget --info
Windows Package Manager v1.10.340
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.26100.3194
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.25.340.0

Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads
Configuration Modules              %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled

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 by reproducing the issue with the CIM update command, then inspect the results of Get-AppxPackage and the matching directories under C:\Program Files\WindowsApps. No source file or test is named; done means determining whether the previous version folders should be removed and identifying the relevant cleanup behavior or documenting why they remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.