Skip to content

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

Open
sean-r-williams wants to merge 1 commit into
PowerShell: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 into
PowerShell:masterfrom
sean-r-williams:1953_update-psresource-prerelease-to-full-release

Conversation

@sean-r-williams
Copy link
Copy Markdown
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

@kilasuit
Copy link
Copy Markdown

kilasuit commented Mar 20, 2026

@sean-r-williams re this

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.

I'd just write a test against the available PSResourceGet versions as opposed to creating other test modules for this as PSResourceGet does have pre-release and non-prerelease versions as I can't see the team delisting a version unless really needed

Copy link
Copy Markdown
Member

@anamnavi anamnavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this bugfix @sean-r-williams and my apologies for the delay in getting to it! I've linked the upstream branch/PR here where I'm running tests, but you'll notice I've published the module version as you mentioned and added a test. You'll want to rebase your branch and add that test, thanks!

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

3 participants