Skip to content

Check NuGet updates against the newest installed version - #5626

Merged
Marc-André Moreau (mamoreau-devolutions) merged 1 commit into
mainfrom
claude/xkcd-powershell-update-issue-714972
Oct 29, 2026
Merged

Marc-André Moreau (mamoreau-devolutions) merged 1 commit into
mainfrom
claude/xkcd-powershell-update-issue-714972

Conversation

@mamoreau-devolutions

@mamoreau-devolutions Marc-André Moreau (mamoreau-devolutions) commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • Have you confirmed that this issue is caused by UniGetUI itself, and not by the package manager or the package involved?

Problem

A PowerShell 7 module such as XKCD keeps showing up in Software Updates with the same installed version, even though every update from UniGetUI succeeds (exit code 0). Running Update-PSResource outside UniGetUI behaves as expected.

Update-PSResource installs each new version next to the old ones, and Get-InstalledPSResource lists the copies sorted as strings rather than as versions:

1.9.0, 1.8.1, 1.8.0, 1.12.6, 1.12.4, 1.11.0, 1.10.5, 1.10.3, 1.10.1

The update check took whichever copy was listed last, so it reported 1.10.1 as installed after each update. The operation history shows 1.10.1 → 1.10.3, 1.10.1 → 1.10.5, 1.10.1 → 1.11.0 and 1.10.1 → 1.12.4, all marked as succeeded.

Fix

  • BaseNuGet.SelectNewestInstalled picks the highest installed version for each package id. When two copies have the same version, the last one listed wins, as before.
  • The V2 (GetUpdates()), V3 and local folder feed update paths now take the installed version from that copy.
  • The update scope comes from the same copy, so the version and scope still match ([BUG] Powershell modules always updates as User Scope #5163).
  • KeepUpdatesNewerThanInstalled uses the new helper instead of its own copy of the logic.

This covers all the NuGet-based managers: PowerShell, PowerShell 7, .NET Tool and Chocolatey.

Notes for reviewers

  • A module installed in both scopes now takes its scope from the copy with the newest version, not from the last copy listed. Before, the last copy listed was always CurrentUser.
  • BuildV2UpdateUrls still sends the oldest installed version on purpose. KeepUpdatesNewerThanInstalled filters the results.

Testing

  • Two new tests in PowerShell7ManagerTests. One uses XKCD's real listing order and expects 1.12.6 → 1.12.7. The other checks that the scope comes from the newest copy.
  • PowerShell7ManagerTests, NuGetV3ManagerTests and NuGetLocalFeedTests pass on net10.0 and net10.0-windows.
  • dotnet format (whitespace and style) leaves no changes.
  • Checked in a Debug build of the app: XKCD showed as 1.12.6 → 1.12.7 (it had been stuck at 1.10.1), and updating it from UniGetUI succeeded.

🤖 Generated with Claude Code

Update-PSResource installs each new version side by side, and
Get-InstalledPSResource lists the copies sorted as strings (1.9.0,
1.12.6, 1.10.1). The update check took whichever copy was enumerated
last, so a module like XKCD kept reporting 1.10.1 as installed and
looked like it never updated, even though every update succeeded.

Pick the highest installed version per id for the V2, V3 and local
feed update paths, and take the update scope from that same copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) merged commit c6400a4 into main Oct 29, 2026
8 of 9 checks passed
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) deleted the claude/xkcd-powershell-update-issue-714972 branch October 29, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant