winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Fix: Prevent reinstallation of already installed versions during upgrade

Open Kenxpx opened this issue 6 months ago • 2 comments

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

Kenxpx avatar May 29 '25 00:05 Kenxpx

@microsoft-github-policy-service agree

Kenxpx avatar May 29 '25 00:05 Kenxpx

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