Skip to content

Multiple installed versions of .NET Desktop Runtime are incorrectly matched when running winget upgrade. #4158

Open

Description

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:

  1. Install .NET Desktop Runtime 6.0 with WinGet: winget install Microsoft.DotNet.DesktopRuntime.6.
  2. Install .NET Desktop Runtime 7.0 but 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).
  3. Now, run winget upgrade and see that an update is offered, however, it is for Microsoft.DotNet.DesktopRuntime.6 trying 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
  1. If we now uninstall Microsoft Windows Desktop Runtime - 7.0.15 from Settings or Control Panel and run winget upgrade again, 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

Activity

  1. github-actions commented on Feb 9, 2024

    @github-actions

    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:

    Closed similar issues:

    Note: You can give me feedback by thumbs upping or thumbs downing this comment.

  2. MaanuelMM commented on Feb 9, 2024

    @MaanuelMM
    Author

    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).

    image

  3. added
    Issue-Feature
    and removed
    Needs-Triage
    on Feb 12, 2024
  4. Trenly commented on Mar 6, 2024

    @Trenly
    Contributor

    [Policy] Issue-Bug
    [Policy] Area-Matching
    [Policy] Command-Upgrade

  5. added
    Area-Matching
    Command-Upgrade
    Issue-Bug
    and removed
    Issue-Feature
    on Mar 6, 2024
  6. grimson73 commented on Mar 20, 2024

    @grimson73
    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'

  7. grimson73 commented on Mar 20, 2024

    @grimson73

    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
    
  8. denelon commented on Mar 25, 2024

    @denelon
    Collaborator

    We're doing some work to handle side-by-side installed packages better.

    I'm expecting a WinGet 1.8-preview release with the experimental feature to be available soon.

  9. akrymskiy commented on Apr 3, 2024

    @akrymskiy

    After fiddling around and (also) running: Get-AppxPackage Microsoft.DesktopAppInstaller | Reset-AppxPackage

    Seems that the '7 -> 8 upgrade' isn't showing anymore:

    Thank you! This fixed it for me also!

  10. soredake commented on Apr 3, 2024

    @soredake

    No change for me with this new preview version and sideBySide set to true.

  11. denelon commented on Apr 3, 2024

    @denelon
    Collaborator

    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:

    Please provide feedback at:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-MatchingCommand-UpgradeIssue-Bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions