Skip to content

Update-PSResource: Include local-copy prerelease string when deciding update applicability#1954

Open
sean-r-williams wants to merge 1 commit intoPowerShell:masterfrom
sean-r-williams:1953_update-psresource-prerelease-to-full-release
Open

Update-PSResource: Include local-copy prerelease string when deciding update applicability#1954
sean-r-williams wants to merge 1 commit intoPowerShell:masterfrom
sean-r-williams:1953_update-psresource-prerelease-to-full-release

Conversation

@sean-r-williams
Copy link
Contributor

@sean-r-williams sean-r-williams commented Feb 28, 2026

PR Summary

This PR updates Microsoft.PowerShell.PSResourceGet.Cmdlets.UpdatePSResource to consider a locally-installed resource's prerelease string when comparing against the repository's available versions.

Fixes #1953.

PR Context

Currently, Update-PSResource only considers the locally-installed resource's version component from the PSResourceInfo.Version field, of type System.Version. This struct doesn't include prerelease strings - PSResourceInfo.Prerelease contains those.

This means that if I have:

  • A locally-installed resource, with version 1.0.1-pre
  • A remote repository resource, with version 1.0.1
  • The same version number between the two (sans prerelease - i.e. the module's prerelease "graduated")
    ...then Update-PSResource will mistakenly mark the locally-installed version as "up to date".

JiraPS, which recently released 2.15.0 (having previously released 2.15.0-alpha1 in 2024, falls into this bucket.

This behavior needs a test. Publishing a test module to Gallery with a prerelease, then normal-release version (i.e. 1.0.1-pre and 1.0.1) would be enough to test this behavior.

If someone from the Gallery team can publish a test module, I'm happy to contribute a test to test\UpdatePSResourceTests\UpdatePSResourceV2.Tests.ps1 as part of this PR.

PR Checklist

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update-PSResource fails to upgrade same-version prerelease -> full release

1 participant