Getting available versions for a specific id

Topics: General
Apr 17, 2013 at 5:05 PM

I'm in the process of setting up a local repository to replace our old library folder that we currently use for 3rd party libraries.

Because I don't want to have to upgrade everything as I'm doing it, I have the need to install the specific version to our local repository that matches the one currently in use.

I've tried using Get-Package -ListAvailable -Filter <PackageName> -AllVersions, but I might as well go and make a cup of coffee before coming back to sift through the potentially huge list of available versions to find the one that I want.

If I already know the id of the package that I need, can I specify this in the filter somehow (I tried "<PackageName>" but to no avail)?

I know that I could just do Install-Package <PackageName> -Version a.b.c.d, but some of the versions that we are using were not published to NuGet, so we will have to choose the closest version available.

I can also do it via the website, but wanted to do it through the console.

I guess I don't see the point in the -AllVersions switch on Get-Package if it returns so much noise.

Any help appreciated.

Apr 18, 2013 at 12:10 AM
Unfortunately, it is not possible with the Get-Package command. Have you tried using NuGet Package Explorer tool?
Apr 19, 2013 at 7:37 AM

I gave it a go but it's still a slow process if you are trying to get versions of something like 'facebook' because that is such a common word to have in both tags and descriptions. It is marginally better, because it collates everything at the end.

I guess the web api used by both doesn't allow that granularity.

Actually, when I know the exact id, it's easier to just go to<id>, and find the version that way.

Thanks for the help.

Apr 19, 2013 at 7:40 AM
To make it faster, search for 'id:facebook'. It will then search for only 'facebook' package id. I recently blogged about this search syntax
Apr 19, 2013 at 9:04 AM
Just what I was looking for, works well with NuGet Package Explorer, thanks!

Any plans to make this work in Get-Package?

Apr 19, 2013 at 4:03 PM
We don't have plan right now, but I'll log an issue for this.
Apr 19, 2013 at 7:38 PM
carlmwright wrote:
Just what I was looking for, works well with NuGet Package Explorer, thanks!

Any plans to make this work in Get-Package?

Have you tried

Get-Package -ListAvailable -Filter 'id:facebook'

If so, is it satisfactory?
Apr 19, 2013 at 11:36 PM
Edited Apr 19, 2013 at 11:37 PM

Yeah, I tried that. What happens is that you only get things with facebook somewhere in the id.

This means that you still get a lot of results (although a lot less than without the id:), but it is still slow to work through when you add -AllVersions to it.

In the Package Explorer it works as I want it to work, but I expected the two to be the same, I guess.

I can use the explorer for now, and I'm not likely to really want to get specific versions after we've finished migrating. Plus, most of the things in our existing library predate nuget, so I will end up creating our own internal packages for those specific versions anyway.