Fix: Prevent reinstallation of already installed versions during upgrade
This PR fixes an issue where winget upgrade would show packages for upgrade even when the exact version was already installed.
Problem
If multiple versions of a package are installed (e.g., via different channels), winget upgrade doesn't correctly match all installed versions. It may show an upgrade even if a matching version is already installed.
Fix
This fix iterates over all installed versions and uses the first one that matches the available version and channel. If a match is found, it skips the reinstallation.
Impact
Prevents redundant upgrade suggestions and improves reliability of winget upgrade.
Fixes #2960
Microsoft Reviewers: Open in CodeFlow
@microsoft-github-policy-service agree
Hello @@Kenxpx,
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.
Template: msftbot/noRecentActivity