Reputation: 3213
What does a nuget package actually consist of, apart from the compiled libraries?
Is it possible to download these packages without using the package manager and use them elsewhere?
Thanks!
Upvotes: 16
Views: 14830
Reputation: 38106
Referencing NuGet may work some (most?) of the time, but you may also run into versioning issues. For example, try adding the Microsoft HTTP Client Libraries NuGet package to a .NET 4 project and examine the resulting csproj
file.
First, you'll notice that some of the BCL assemblies have been overriden:
And now all referencing projects have to use these overrides as well (since you can't reference multiple versions of the same assembly). Among other things, it means you lose updates to those assemblies (unless the BCL NuGet package is updated as well).
You will also notice your csproj contains the following entry (it won't work if you remove it):
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
I am not knowledgable about MSBuild, but I'm guessing this could affect your build environment.
Upvotes: 0
Reputation: 506
Just so everyone knows, you can just create an account on nuget.org. Once logged in a download link will appear on the left toolbar that will allow you to directly download any .nupkg file.
Upvotes: 2
Reputation: 592
You can also use the command line tool nuget.exe to download the nupkg file, like this:
nuget install packageId
to get the latest version, or
nuget install packageId -Version version
to get the specific version.
Upvotes: -2
Reputation: 138
Sorry, this should be a comment, but I don't have enough rep.
Based on the html generated by the Chrome extension mentioned in this answer, we can improve gth685f's answer by noting that, to download packages that are not the latest, the URL is packages.nuget.org/api/v2/package/<PACKAGE_YOU_WANT>/<VERSION_NUMBER>
(note the incremented API version number too).
Upvotes: 1
Reputation: 519
Additional comment: After downloading the *.zip (example jquery) change the ending from *.zip to *.nupkg and then you are able to install them with the Package Manager in VS. Perhaps it's just me who had to think about it for a while. If not, hope it helps.
Upvotes: 1
Reputation: 137544
Based on @Gth685's answer, I made a Google Chrome extension that adds download links to package pages on http://nuget.org
https://chrome.google.com/webstore/detail/nutake/ibhhbcaipjilldjkhhblhgdedjgoecap?hl=en
Upvotes: 7
Reputation: 1563
Just to add that the V2 api is the same format as V1 to download a package using your browser.
http://packages.nuget.org/api/v2/package//
Upvotes: 0
Reputation: 585
You can download them from http://packages.nuget.org/api/v1/package/<PACKAGE_YOU_WANT>/ using your browser.
You can get the package name from: http://packages.nuget.org/Packages
Example: jQuery UI (Combined Library) Package is at: http://packages.nuget.org/packages/jQuery.UI.Combined To download: http://packages.nuget.org/api/v1/package/jQuery.UI.Combined/
Upvotes: 29
Reputation: 1038730
What does a nuget package actually consist of, apart from the compiled libraries?
Take a look here. Basically it is a file with the .nupkg
extension which is nothing more than a .zip file containing the structure explained in the previous link and some xml metadata.
Is it possible to download these packages without using the package manager and use them elsewhere?
Sure, simply download the .nupkg
file.
Upvotes: 13