PowerShell / PowerShell/PSResourceGet

NuGet API v2 `Find-PSResource -Prerelease` does not return prerelease if there is any newer stable release(s)

Open
#1,607 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Find feature_request Issue-Discussion
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.

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.