David Peden
David Peden

Reputation: 18464

How do you get prerelease packages using powershell's Find-Package?

I am using Find-Package from Powershell 5.0. I need to query for pre-release packages. Is this possible?

I am aware that I can fall back to using nuget.exe list -prerelease if necessary.

Upvotes: 1

Views: 568

Answers (3)

etalon11
etalon11

Reputation: 984

In Powershell you have to use the command "-AllowPrereleaseVersions" as documented here:

https://learn.microsoft.com/de-de/powershell/module/packagemanagement/find-package?view=powershell-7.1

Here is the hint on the differences betweeen PackageManager in Visual Studio and in Powershell: https://learn.microsoft.com/de-de/nuget/reference/ps-reference/ps-ref-find-package

Version 3.0+; this topic describes the command within the Package Manager Console in Visual Studio on Windows. For the generic PowerShell Find-Package command, see the PowerShell PackageManagement reference.

Upvotes: 0

Imre Pühvel
Imre Pühvel

Reputation: 5004

According to the nuget powershell documentation there is the -IncludePreRelease option:

Find-Package [Id] [-Source ] [-First ] [-Skip ] [-AllVersions] [-IncludePrerelease] [-ExactMatch]

Test:

PM> Find-Package Microsoft.AspNet.Identity.EntityFramework -Exact Microsoft.AspNet.Identity.Entity... {2.2.1}

PM> Find-Package Microsoft.AspNet.Identity.EntityFramework -Exact -IncludePreRelease Microsoft.AspNet.Identity.Entity... {3.0.0-rc1-final}

Upvotes: 0

David Peden
David Peden

Reputation: 18464

It appears that the -AllVersions parameter will include them.

Upvotes: 1

Related Questions