In case you are running Visual Studio Express (prior to 2012), MonoDevelop, SharpDevelop or anything other than the paid version of Visual Studio, you cannot use the integrated NuGet Package Manager. There is a way to use NuGet command-line version to still achieve what you need, and it also works on Linux with Mono. This way you can use it in the manner of traditional command-line package managers. At the time this article was written, current NuGet command-line version was 2.2.
Note: In order to use NuGet from the command-line in any directory, it needs to be on one of the paths defined by your PATH system variable.
Install the specified package (latest, if version is not specified) Use '-version' to specify version nuget install nunit nuget install nunit -version 2.6.1 Install all packages defined in the 'packages.config' file Use '-o' to specify output directory (relative to the working directory) nuget install nuget install -o "vendor" Display all available packages nuget list Update all packages and NuGet to the latest version. Use '-self' to only update NuGet nuget update nuget update -self
In order to automate and simplify the installation of your dependencies, you can create two configuration files for NuGet inside your project directory. Create nuget.config (optional), to specify the output directory. NuGet will search for this file from the root of your drive to the current working directory. If this file is missing, packages will be installed in the current working directory. Visit NuGet configuration file page for more info.
<configuration> <config> <!-- install packages to 'vendor' subdirectory --> <add key="repositoryPath" value="vendor" /> </config> </configuration>
Create packages.config to specify the list of packages your project requires. With this file in your repository, everyone will be able to checkout the project and get the required dependencies.
<packages> <package id="NUnit" version="2.6.2" /> <package id="NSubstitute" version="184.108.40.206" /> <package id="log4net" version="2.0.0" /> </packages>
Proposed project folder structure:
With nuget.config and packages.config in the project directory, it is enough to run nuget install, and all dependencies will be downloaded and installed.