1

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.

David Peden
  • 17,596
  • 6
  • 52
  • 72

3 Answers3

1

It appears that the -AllVersions parameter will include them.

David Peden
  • 17,596
  • 6
  • 52
  • 72
0

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}

Imre Pühvel
  • 4,468
  • 1
  • 34
  • 49
  • 2
    Yeah, oddly enough, `-IncludePrerelease` only works inside of Visual Studio. It does _not_ exist in a powershell prompt. – David Peden May 12 '16 at 20:32
  • 1
    It seems visual studio uses a Powershell module named `nuget` which is different from module `PackageManagement` outside VS. Interesting difference as prerelease option has nothing VS-specific about it. [Related post](http://stackoverflow.com/a/22256792/331325) – Imre Pühvel May 12 '16 at 20:46
0

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.

etalon11
  • 895
  • 2
  • 13
  • 36