Multiple installed versions of .NET Desktop Runtime are incorrectly matched when running `winget upgrade`.
Brief description of your issue
When multiple versions of Microsoft .NET Desktop Runtime are installed under certain circumstances (see below), WinGet CLI will incorrectly identify some of them, offering an update that it should not.
Steps to reproduce
First of all, I should comment that this has supposedly happened as a result of a Lenovo Vantage Service update due to dependencies it has with both Microsoft ASP.NET Core 7.0.15 - Shared Framework (x64) and Microsoft Windows Desktop Runtime - 7.0.15 (x64) and which I have managed to successfully recreate on a relatively fresh Windows 10 Version 22H2 virtual machine running on Hyper-V.
With that said, here are the step-by-step instructions on how to reproduce it:
- Install
.NET Desktop Runtime 6.0with WinGet:winget install Microsoft.DotNet.DesktopRuntime.6. - Install
.NET Desktop Runtime 7.0but instead of using WinGet, download the installer from the official website and install it manually (be sure it's the Desktop Runtime and matching architecture). - Now, run
winget upgradeand see that an update is offered, however, it is forMicrosoft.DotNet.DesktopRuntime.6trying to update to.NET 7.0(looks like a mismatch):
Name Id Version Available Source
------------------------------------------------------------------------------------------------------------
Microsoft Windows Desktop Runtime - 7.0.15 (x64) Microsoft.DotNet.DesktopRuntime.6 > 6.0.26 7.0.15 winget
- If we now uninstall
Microsoft Windows Desktop Runtime - 7.0.15fromSettingsorControl Paneland runwinget upgradeagain, it will report no updates available, as it should:
No installed package found matching input criteria.
Diving into the WinGet logs, I have detected the following:
2024-02-09 22:00:00.928 [REPO] Finding available package from installed package using system reference search: Query:[none] Include:ProductCode='{678ecfdb-8552-4dd3-9bd7-ed16b0f23ae2}'[Exact] Include:NormalizedNameAndPublisher='microsoftwindowsdesktopruntime'+'microsoft'[Exact] Include:NormalizedNameAndPublisher='microsoftwindowsdesktopruntime(x64)'+'microsoft'[Exact]
2024-02-09 22:00:00.964 [REPO] Found multiple matches for installed package [{678ecfdb-8552-4dd3-9bd7-ed16b0f23ae2}] in source [Microsoft.Winget.Source_8wekyb3d8bbwe] when searching for [Query:[none] Include:ProductCode='{678ecfdb-8552-4dd3-9bd7-ed16b0f23ae2}'[Exact] Include:NormalizedNameAndPublisher='microsoftwindowsdesktopruntime'+'microsoft'[Exact] Include:NormalizedNameAndPublisher='microsoftwindowsdesktopruntime(x64)'+'microsoft'[Exact]]
2024-02-09 22:00:00.965 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.7
2024-02-09 22:00:00.966 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.Preview
2024-02-09 22:00:00.967 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.8
2024-02-09 22:00:00.968 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.6
2024-02-09 22:00:00.968 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.5
2024-02-09 22:00:00.969 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.3_1
[...]
2024-02-09 22:00:01.025 [REPO] Finding available package from installed package using system reference search: Query:[none] Include:ProductCode='{b2476903-b8da-4dcc-903f-378730bb4c48}'[Exact] Include:NormalizedNameAndPublisher='microsoftwindowsdesktopruntime'+'microsoft'[Exact] Include:NormalizedNameAndPublisher='microsoftwindowsdesktopruntime(x64)'+'microsoft'[Exact]
2024-02-09 22:00:01.056 [REPO] Found multiple matches for installed package [{b2476903-b8da-4dcc-903f-378730bb4c48}] in source [Microsoft.Winget.Source_8wekyb3d8bbwe] when searching for [Query:[none] Include:ProductCode='{b2476903-b8da-4dcc-903f-378730bb4c48}'[Exact] Include:NormalizedNameAndPublisher='microsoftwindowsdesktopruntime'+'microsoft'[Exact] Include:NormalizedNameAndPublisher='microsoftwindowsdesktopruntime(x64)'+'microsoft'[Exact]]
2024-02-09 22:00:01.057 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.6
2024-02-09 22:00:01.057 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.Preview
2024-02-09 22:00:01.058 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.8
2024-02-09 22:00:01.058 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.7
2024-02-09 22:00:01.058 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.5
2024-02-09 22:00:01.059 [REPO] Checking match with package id: Microsoft.DotNet.DesktopRuntime.3_1
2024-02-09 22:00:01.068 [REPO] Opening pinning index
2024-02-09 22:00:01.068 [REPO] Opening existing pinning index
2024-02-09 22:00:01.068 [REPO] Opening SQLite Index for ReadWrite at 'C:\Users\test\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db'
2024-02-09 22:00:01.068 [SQL ] Opening SQLite connection #6: 'C:\Users\test\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db' [2, 0]
2024-02-09 22:00:01.070 [REPO] Opened Pinning Index with version [1.0], last write [2023-12-26 15:10:19.000]
2024-02-09 22:00:01.123 [REPO] Did not find a Version for { 7.0.15 }
2024-02-09 22:00:01.124 [REPO] Did not find a Version for { 7.0.15 }
2024-02-09 22:00:01.151 [CLI ] Leaf command succeeded: root:upgrade
The interesting part here is that there are multiple possible matches but there's no Appropriate available package could not be determined message, and then seems to be that it's calling on pinning.db and that's where it maybe determines that .NET 6.0 was installed previously with WinGet so it (mis)match the .NET 7.0 installation as a .NET 6.0 installation too? I don't really know.
Expected behavior
It should detect Microsoft Windows Desktop Runtime - 7.0.15 as Microsoft.DotNet.DesktopRuntime.7 instead of Microsoft.DotNet.DesktopRuntime.6.
Actual behavior
It mismatch the Microsoft Windows Desktop Runtime - 7.0.15 package ID because it was installed without WinGet and there's another version that was installed previously using WinGet.
Environment
Windows Package Manager v1.6.3482
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.19045.3930
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3482.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
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 Enabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride Disabled
LocalArchiveMalwareScanOverride Disabled
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Open similar issues:
- winget tries to upgrade .NET 5 Runtime over and over (#2345), similarity score: 0.80
- winget upgrade fails to list correct version and reinstalls even if latest version is installed (#2867), similarity score: 0.76
- winget upgrade incorrect version (#3481), similarity score: 0.73
Closed similar issues:
- Wrong .NET SDK version number when using winget upgrade (#3070), similarity score: 0.77
- winget upgrade sometimes creates new installation instead of upgrading (#1212), similarity score: 0.73
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Regarding this, I've noticed .NET installations have a property in the Windows registry called BundleUpgradeCode, however, according to the WinGet logs, this value never seems to be taken into account when matching, so I understand that this could be where the wrong matching is coming from because, as far as I know, upgrade codes are used for tracking upgrades (as on Windows Installer).
[Policy] Issue-Bug [Policy] Area-Matching [Policy] Command-Upgrade
winget list .net
Name Id Version Source
---------------------------------------------------------------------------------------------------------------------------
Microsoft ASP.NET Core 7.0.17 - Shared Framework (x64) Microsoft.DotNet.AspNetCore.7 7.0.17 winget
Microsoft ASP.NET Core 8.0.3 - Shared Framework (x64) Microsoft.DotNet.AspNetCore.8 8.0.3 winget
Microsoft Windows Desktop Runtime - 7.0.17 (x64) Microsoft.DotNet.DesktopRuntime.7 7.0.17 winget
Microsoft Windows Desktop Runtime - 8.0.3 (x64) Microsoft.DotNet.DesktopRuntime.8 8.0.3 winget
Microsoft .Net Native Framework Package 2.2 Microsoft.NET.Native.Framework.2.2_8wekyb3d8bbwe 2.2.29512.0
Microsoft .Net Native Runtime Package 2.2 Microsoft.NET.Native.Runtime.2.2_8wekyb3d8bbwe 2.2.28604.0
Microsoft .Net Native Framework Package 1.7 Microsoft.NET.Native.Framework.1.7_8wekyb3d8bbwe 1.7.27413.0
Microsoft .Net Native Runtime Package 1.7 Microsoft.NET.Native.Runtime.1.7_8wekyb3d8bbwe 1.7.27422.0
Microsoft .NET Core SDK Uninstall Tool (x86) Microsoft.DotNet.UninstallTool 4.96.657 winget
winget update
Name Id Version Available Source
-----------------------------------------------------------------------------------------------------------
Microsoft Windows Desktop Runtime - 8.0.3 (x64) Microsoft.DotNet.DesktopRuntime.7 > 7.0.17 8.0.3 winget
1 upgrades available.
winget --info
Windows Package Manager v1.7.10661
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22631.3296
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.10661.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
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
Same issue with Microsoft.DotNet.DesktopRuntime.7 -> 8. Strangely not for 'Microsoft.DotNet.AspNetCore.7 -> 8'
After fiddling around and (also) running:
Get-AppxPackage Microsoft.DesktopAppInstaller | Reset-AppxPackage
Seems that the '7 -> 8 upgrade' isn't showing anymore:
winget list .net
Name Id Version Source
---------------------------------------------------------------------------------------------------------------------------
Microsoft ASP.NET Core 7.0.17 - Shared Framework (x64) Microsoft.DotNet.AspNetCore.7 7.0.17 winget
Microsoft ASP.NET Core 8.0.3 - Shared Framework (x64) Microsoft.DotNet.AspNetCore.8 8.0.3 winget
Microsoft Windows Desktop Runtime - 8.0.3 (x64) Microsoft.DotNet.DesktopRuntime.8 8.0.3 winget
Microsoft Windows Desktop Runtime - 7.0.17 (x64) Microsoft.DotNet.DesktopRuntime.7 7.0.17 winget
Microsoft .Net Native Framework Package 2.2 Microsoft.NET.Native.Framework.2.2_8wekyb3d8bbwe 2.2.29512.0
Microsoft .Net Native Runtime Package 2.2 Microsoft.NET.Native.Runtime.2.2_8wekyb3d8bbwe 2.2.28604.0
Microsoft .Net Native Framework Package 1.7 Microsoft.NET.Native.Framework.1.7_8wekyb3d8bbwe 1.7.27413.0
Microsoft .Net Native Runtime Package 1.7 Microsoft.NET.Native.Runtime.1.7_8wekyb3d8bbwe 1.7.27422.0
Microsoft .NET Core SDK Uninstall Tool (x86) Microsoft.DotNet.UninstallTool 4.96.657 winget
winget upgrade
No installed package found matching input criteria.
winget --info
Windows Package Manager v1.7.10661
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22631.3296
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.10661.0
We're doing some work to handle side-by-side installed packages better.
- https://github.com/microsoft/winget-cli/discussions/4281
I'm expecting a WinGet 1.8-preview release with the experimental feature to be available soon.
After fiddling around and (also) running:
Get-AppxPackage Microsoft.DesktopAppInstaller | Reset-AppxPackageSeems that the '7 -> 8 upgrade' isn't showing anymore:
Thank you! This fixed it for me also!
No change for me with this new preview version and sideBySide set to true.
Just posting for others who find this issue:
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