PowerShell / PowerShell/PSResourceGet
NuGet API v2 `Find-PSResource -Prerelease` does not return prerelease if there is any newer stable release(s)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 576
- Forks
- 114
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 7
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
PowerShell Gallery / NuGet API v2 Find-PSResource -Prerelease -Name 'Az.Accounts' returns a stable release rather than a prerelease.
I expect this cmdlet to return the newest prerelease version, even if there's newer stable release(s) available.
- Az.Accounts in PowerShell gallery: https://www.powershellgallery.com/packages/Az.Accounts
- Doc on
-Prereleaseparameter: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.psresourceget/find-psresource?view=powershellget-3.x#-prerelease
Observation
Doing Find-PSResource -Name 'Az.Accounts' -Prerelease -Debug tells us that PSResourceGet does a GET to:
Which indeed just returns the absolute newest version, whether it's a prerelease or not.
Workaround
Following URL in my testing returns the newest prerelease, and does not care if newer stable release(s) exsists.
This works if asking for one package Id at a time. Don't know if it's possible to achieve this if asking for multiple Ids in the same request.
Expected behavior
Return newest prerelease version
Actual behavior
Returns absolute latest version, whether it's a prerelease or not.
Error details
No response
Environment data
Not relevant.
Visuals
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing Find-PSResource -Prerelease -Name 'Az.Accounts' and inspect the documented NuGet API v2 requests in the issue. Compare the IsAbsoluteLatestVersion query with the IsPrerelease, Version-descending workaround. Done means the command returns the newest prerelease even when a newer stable release exists, including confirming the behavior for the supported package-name query cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100