12

I'm trying to figure out a workaround for an issue I have with jQuery 2.0 being the version Nuget wants to update to via the GUI (Can I keep Nuget on the jQuery 1.9.x/1.x path (instead of upgrading to 2.x)?).

Looking at this answer to another question it appears that I should be able to use the Nuget console to get all versions of jQuery:

Get-Package -ListAvailable -Filter 'jQuery' -AllVersions

Then I should be able to pick the version I want and update it:

Install-Package jQuery -Version 1.9.1

or

Update-Package jQuery -Version 1.9.1

Unfortunately, while updating works perfectly, trying to get a list of jQuery versions ends up grabbing numerous projects that merely refer to or contain jQuery in their title.

I suppose I could use Open-PackagePage, but that seems klunky.

However, I don't see any parameters that suggest I can filter by Id in the official docs.

Is there a way to restrict the Nuget console to search only by project Id? Or is there some other way I can get a listing of versions of jQuery using the Nuget console? I've tried quotes around my jQuery filter (-filter 'jQuery') but that didn't resolve the issue either.

Community
  • 1
  • 1
James Skemp
  • 8,018
  • 9
  • 64
  • 107
  • Looks like there is no `-Id` parameter available for `Get-Package` (like there is for `Install-Package` and others), and I can see this being useful. I'd suggest submitting an issue on the NuGet issue tracker: https://nuget.codeplex.com/workitem/list/advanced – Julian Apr 22 '13 at 13:44

1 Answers1

17

Type Install-Package JQuery -Version then Space, then Tab.

This displays a list of all available versions for that package.

The problem with Get-Package and its -Filter option is that it does a search of both ID and Description fields. I agree that it would be very useful if there was an -ID option or similar.

Dave R.
  • 7,206
  • 3
  • 30
  • 52
  • 1
    This solution doesn't always work. As of today, if I type type above command, the latest version shows as 1.10.2 not 1.11.2. But if I type 1.11.2 the command works, so clearly the version exists. – Moby Disk Feb 25 '15 at 16:59
  • 1
    @MobyDisk Make sure your Package Source is set to nuget.org and not the Microsoft Curated Packages feed. (There's a drop-down in the Package Manager Console window.) At the time of writing, the nuget feed should be https://www.nuget.org/api/v2/ – Dave R. Feb 26 '15 at 11:39