How to download a Nuget package without nuget.exe or Visual Studio extension?

C#.NetVisual StudioNuget

C# Problem Overview


How can I download a NuGet package? I don't have the NuGet Visual Studio extension or the command line program nuget.exe. How can I download the .nupack file from the web? As I understand I will be able to extract the .dll files from it (with 7-zip) to use as normal.

The package I happen to be interested in is http://nuget.org/packages/Microsoft.Bcl.Async, but I would like to know how to do this generally.

In the world of Ruby this would be easy - every package page on the RubyGems website has a download link to a .gem file, e.g.: https://rubygems.org/gems/pony


The argument over NuGet's manifest destiny belongs elsewhere. It doesn't matter to this question why I eschew it. I'm not the only one though.

C# Solutions


Solution 1 - C#

Either make an account on the Nuget.org website, then log in, browse to the package you want and click on the Download link on the left menu.


Or guess the URL. They have the following format:

https://www.nuget.org/api/v2/package/{packageID}/{packageVersion}

Then simply unzip the .nupkg file and extract the contents you need.

Solution 2 - C#

Although building the URL or using tools is still possible, it is not needed anymore.

https://www.nuget.org/ currently has a download link named "Download package", that is available even if you don't have an account on the site.

(at the bottom of the right column).


Example of EntityFramework's detail page: https://www.nuget.org/packages/EntityFramework/: (Updated after comment of kwitee.)

Example of EntityFramework's detail page

Solution 3 - C#

Based on Xavier's answer, I wrote a Google chrome extension NuTake to add links to the Nuget.org package pages.

Solution 4 - C#

To obtain the current stable version of the NuGet package use:

https://www.nuget.org/api/v2/package/{packageID}

Solution 5 - C#

I haven't tried it yet, but it looks like NuGet Package Explorer should be able to do it:

https://github.com/NuGetPackageExplorer/NuGetPackageExplorer

NuGet Package Explorer

(or like Colonel Panic says, 7-zip should probably do it)

Solution 6 - C#

  1. Go to http://www.nuget.org
  2. Search for desired package. For example: Microsoft.Owin.Host.SystemWeb
  3. Download the package by clicking the Download link on the left.
  4. Do step 3 for the dependencies which are not already installed. Nuget download page
  5. Store all downloaded packages in a custom folder. The default is c:\Package source.
  6. Open Nuget Package Manager in Visual Studio and make sure you have an "Available package source" that points to the specified address in step 5; If not, simply add one by providing a custom name and address. Click OK. Tools->Manage NuGet Packages->Package Manager Settings NuGet Package Manager Options Window
  7. At this point you should be able to install the package exactly the same way you would install an online package through the interface. You probably won't be able to install the package using NuGet console.

Solution 7 - C#

Don't know if this is what you want, but here it is:

  1. Download nuget.exe (∼6.5MB, no install required) from the official NuGet site: https://www.nuget.org/downloads
  2. In CLI type following to retrieve list of available packages: nuget.exe list -source <source-url-here>
  3. Then download the package by typing this: nuget.exe install <package-name> -source <source-url-here> -OutputDirectory <download-directory>

Contents of the downloaded package are the .nupkg file, .dll files for x86 and x64 as well as .props and .targets files. BTW: .nupkg can be opened as a .zip file.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionColonel PanicView Question on Stackoverflow
Solution 1 - C#Xavier DecosterView Answer on Stackoverflow
Solution 2 - C#quasoftView Answer on Stackoverflow
Solution 3 - C#Colonel PanicView Answer on Stackoverflow
Solution 4 - C#WorkSmarterView Answer on Stackoverflow
Solution 5 - C#Alex KeySmithView Answer on Stackoverflow
Solution 6 - C#Mehdi KashefikiaView Answer on Stackoverflow
Solution 7 - C#SemiView Answer on Stackoverflow