32

How can I download NuGet Packages outside of visual studio? so it can be used to create offline packages.

Aviran Cohen
  • 5,581
  • 4
  • 48
  • 75
  • Similar question: http://stackoverflow.com/questions/8597375/how-to-get-the-url-of-a-nupkg-file – Ruskin Jul 11 '14 at 14:06
  • 1
    possible duplicate of [How to download a Nuget package without nuget.exe or Visual Studio extension? from nuget.org](http://stackoverflow.com/questions/14894864/how-to-download-a-nuget-package-without-nuget-exe-or-visual-studio-extension-fr) – Iman Mahmoudinasab Feb 18 '15 at 09:10

6 Answers6

27

How to download NuGet Package without Visual Studio or Nuget Package Manager:

  1. Search your desired package at NuGet Official Site.

  2. Copy the end of the URL of the package page. For Example: http://nuget.org/packages/EntityFramework => Package Name is "EntityFramework"

  3. Enter the URL: http://packages.nuget.org/api/v1/package/{Package Name} For Example: http://packages.nuget.org/api/v1/package/EntityFramework
Aviran Cohen
  • 5,581
  • 4
  • 48
  • 75
  • 5
    Just a note to anyone coming across this question, many years later. When the package downloads, just rename the extension to **`.zip`** as mentioned in the **[solution](http://stackoverflow.com/a/28183316/2333450)** by @Steve. Then when you open the file you will have all the files you need. Sadly I have to do this now, as my offices proxy seems to prevent the use of the Package Manager (Since I get asked for credentials, and my Nuget credentials do not work). – famousKaneis Apr 08 '16 at 20:47
  • another note: the NuGet Gallery has a "Download Package" link on the right... – Daren Thomas Apr 14 '21 at 09:56
19

You can download NuGet packages outside of Visual Studio using:

NuGet Package Explorer

NuGet Package Explorer is a ClickOnce application which allows creating and exploring NuGet packages easily. After installing it, you can double click on a .nupkg file to view the package content. You can also load packages directly from the official NuGet feed.

Open a package from online feed:

enter image description here

enter image description here

And export the package to the desired location:

enter image description here

Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169
  • 1
    This works best. Here is the current link to download this tool: http://nuget.codeplex.com/releases/view/59864 – atconway May 22 '13 at 17:56
  • 1
    @atconway This is now incorrect - I got the following message when I downloaded it from there: "...I have decided to move it permanently to http://npe.codeplex.com ..." – Jeff Jun 18 '14 at 22:26
  • Too bad the link is dead – Enrico Jan 17 '22 at 13:15
15

Install the NuGet command line program:

The NuGet command line may be installed onto a machine in a few possible ways.

  1. Direct download of the executable from https://dist.nuget.org/win-x86-commandline/latest/nuget.exe. The executable may be placed anywhere on the file system, and in most cases should be placed in a directory that is listed in the PATH environment variable.
  2. Install the NuGet.CommandLine package from the NuGet Visual Studio client and either move nuget.exe to a common location or execute it in the context of your project.
  3. Install the NuGet.CommandLine Chocolatey package using the Chocolatey client. More information on Chocolatey can be found at [http://chocolatey.org].

Then run nuget install package to download and install package in the current directory.

More about the NuGet command line program:

Kenny Evitt
  • 9,291
  • 5
  • 65
  • 93
Deepak
  • 2,223
  • 17
  • 15
  • The nuget.exe command-line tool will provide the most flexibility for scripting and automation. – Matthew Skelton Aug 11 '13 at 12:52
  • Just recently I wrote a PowerShell Script to download Packages: https://bitbucket.org/theFil/nugetpackagefetcher/src/d44a5f0c2849e784293f63ffeb9207eaed242cf2/GetPackages.ps1?at=master&fileviewer=file-view-default – Fildor Oct 14 '16 at 11:20
3

Chrome Plugin "NuTake" provides a direct download link.

Rename extension to .zip and extract

Steve
  • 1,995
  • 2
  • 16
  • 25
1

You can download nuget packages using - vnuget.org.

On this website you can also view content of nuget package - http://vnuget.org/packages/Microsoft.AspNet.Mvc/5.2.3.

Sergey
  • 11
  • 1
1

Here are a few examples that can add to DeePak's answer:

This one downloads AutoMapper from NuGet.org

nuget.exe install AutoMapper  -OutputDirectory c:\Temp\LotsOfPackages -Version 6.2.2

This one downloads MyCustomPackage from an internal TFS Nuget feed

nuget.exe install MyCustomPackage  -OutputDirectory c:\Temp\LotsOfPackages -Source "http://tfs.myCompany.com:8080/tfs/TFSArea/_packaging/FeedName/nuget/v3/index.json" -Version 1.0.0.2

Notes

  • Keep in mind that the install command will get the package in question AND all its NuGet dependencies. So, be careful about just dumping this into the directory where you running. Thus, I added OutputDirectory to the command.
  • For internal Nuget packages/feeds, the Source URL is available via TFS. Go to your packages tab and find your specific feed URL. If it has any spaces that have been encoded with %20, you need to replace them with spaces.
  • CLI command reference
  • Copy packages from one NuGet feed to another
David Yates
  • 1,935
  • 2
  • 22
  • 38