This should return a list of all versions right?
Nuget.org, my package source, hosts a lot of versions for this package.
Here they are.
Can someone tell me what I am missing?
The -AllVersions parameter is part of the "Remote" parameter set which includes your parameters so it looks like the parameters are correct.
Looking at the request that is returned from https://nuget.org/api/v2/Search() it does not look like what you are trying to do is supported.
The raw data sent back does not include multiple versions for each NuGet package so, even though there is code in NuGet which does not collapse the versions down to the latest when -AllVersions is specified as it displays the results, you only get the one version for each NuGet package.
The -AllVersions parameter seems to only work when the -Updates parameter is used. This uses a different query https://nuget.org/api/v2/GetUpdates() which returns multiple package versions. So you can only see all NuGet package versions for the updated packages in your project.
Get-Package -AllVersions -Updates -Filter jquery
Related
In Visual Studio, I can right-click the solution, and follow the Manage NuGet Packages for Solution... option to view referenced packages that have updates.
What I'd like to be able to do is to obtain this same information, but from the CLI - either by running a NuGet CLI command or a NuGet PowerShell command. Just a list of packages with updates available, with the current and latest versions would be sufficient.
I've looked through the documentation for both the NuGet CLI and NuGet Powershell, but can't see any candidate commands.
Is this possible? How does the Visual Studio UI pull this information?
I guess Visual Studio is doing this by running two PowerShell commands. First Get-Package, that will list all packages in your project/solution, and then Get-Package -Updates that will list only packages with available updates. After that you can compare two lists, and you will have both current version and latest version. Link to documentation: Get-Package (Package Manager Console in Visual Studio)
I think you could use this command within the package manager console of your solution to get the output you need:
Get-Package -Updates | Select-Object Id, Version, #{Name="CurrentVersion"; Expression ={(Get-Package -filter $_.Id)[0].Versions.Version.ToString()}}
Should get only those packages needing updated and the current version installed.
I'm trying to use the NuGet command line to get the latest version of a package in a repo as part of an MSBuild task. Unfortunately there are three packages which all start with the same thing, for example:
MyCorp.ThirdPartyServices
MyCorp.ThirdPartyServices.DB
MyCorp.ThirdPartyServices.OtherStuff
Therefore the command
nuget.exe list -Source http://mycorp.repo/nuget MyCorp.ThirdPartyServices
Returns all three entries as I'm assuming it's internally adding a wildcard to the end of the search term. Whilst I can deal with this, I'd rather not have to. Is there any way to search for an exact package name or do I just have to suck it up and parse whatever comes out?
You should be able to use a special search syntax to filter the result. The following works on nuget.org:
nuget.exe list packageid:NUnit
This just returns the single NUnit package.
Here I am using NuGet v2.
I'm working in VS 2012. I just downloaded the Entity Framework 6 Alpha3 NuGet package.
I put it in the NuGet folder for quick access.
When I use the command
PM> Get-Package -Filter EntityFramework -ListAvailable
(and related filters 'EF6' and 'Entity')
I cannot find my download.
I can find
Glimpse.EF6. This is not what I'm looking for.
My path to the download:
C:\Program Files (x86)\NuGet\Visual Studio 2012\EF6 Alpha3
My question is where do I need to put the download file so that I can locate it when adding the solution to my project.
I understand how I will add the package to every solution I wish to use it in. I have read the MSDN and codeplex documentation.
I understand that I am merely looking for the package to add to my solution. This is my problem. I put it in the NuGet Program folder and am still unable to find this.
I am sure I'm missing something simple. I am just asking where to put the download of the Alpha3 version of EF6 so that I can locate it using the -ListAvailable command.
Thanks!
From what I can read from your question and comments, it seems like you are missing the basic understanding of how NuGet works and how to use it.
I would highly recommend that you start by reading some documentation about NuGet. The Getting Started page provides a brief introduction, and pay especially good attention to the section named Working with NuGet Packages.
docs.nuget.org is an extensive resource to everything you might need to know about NuGet. The first four links should provide you more than enough information:
Overview
Installing NuGet
Managing NuGet Packages Using The Dialog
Using the Package Manager Console
To answer your specific question about where NuGet packages gets download: the default location is in the packages folder at the root of your solution location. You should however not need to think anything about this, but instead read the above links to understad the basics of NuGet.
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.
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.
I would like to include a content file into the package that should refer to the current version of the package being installed (more precisely to the package folder, but the only varying part is the version).
Is there a special syntax (e.g. $packageversion$ - does not work) to include the version number into a transformed (.pp) content file?
Alternative: I can access the version from the install.ps1 and I can also invoke Add-Content (i suppose that will also apply the transformations), but how can I extend the replacement placeholders?
The variables you can use (like $rootnamespace$) are the ProjectProperties so you won't be able to access the version number.
As a workaround, you could try naming the file as part of your build step that creates the NuGet package.
If you think it'd be good to see this added to NuGet, it's worth starting a discussion on the NuGet site, the developers are pretty active there :-)