install command (NuGet CLI)

Applies to: package consumption • Supported versions: all

Downloads and installs a package into a project using the specified package sources.

Tip

The nuget.exe CLI downloads packages within the context of a project. To download a package directly outside the context of a project, visit the package's page on nuget.org and select the Download link.

If no sources are specified, those listed in the global configuration file, %APPDATA%\NuGet\NuGet.Config, will be used. See Configuring NuGet Behavior for additional details.

If no specific packages are specified, install installs all packages listed in the project's packages.config file, making it similar to restore. In this case, install does not work with projects that use project.json.

The install command does not modify a project file or packages.config; in this way it's similar to restore in that it only adds packages to disk but does not change a project's dependencies.

To add a dependency, either add a project through the Package Manager UI or Console in Visual Studio, or modify packages.config and then run either install or restore. For projects using project.json, you can modify that file and then run restore.

Usage

nuget install <packageID | configFilePath> [options]

where <packageID> names the package to install (using the latest version), or <configFilePath> identifies the packages.config file that lists the packages to install. You can indicate a specific version with the -Version option.

Options

Option Description
ConfigFile (2.5+) The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config is used.
DisableParallelProcessing Disables installing multiple packages in parallel.
ExcludeVersion Installs the package to a folder named with only the package name and not the version number.
FallbackSource (3.2+) A list of package sources to use as fallbacks in case the package isn't found in the primary or default source.
FileConflictAction (2.5+) Specifies the action to take when asked to overwrite or ignore existing files referenced by the project. Values are overwrite, ignore, none.
ForceEnglishOutput (3.5+) Forces nuget.exe to run using an invariant, English-based culture.
Framework (4.4+) Target framework used for selecting dependencies. Defaults to 'Any' if not specified.
Help Displays help information for the command.
NoCache Prevents NuGet from using packages from local machine caches.
NonInteractive Suppresses prompts for user input or confirmations.
OutputDirectory Specifies the folder in which packages are installed. If no folder is specified, the current folder is used.
PackageSaveMode Specifies the types of files to save after package installation: one of nuspec, nupkg, or nuspec;nupkg.
PreRelease Allows prerelease packages to be installed. This flag is not required when restoring packages with packages.config.
RequireConsent Verifies that restoring packages is enabled before downloading and installing the packages. For details, see Package Restore.
SolutionDirectory Specifies root folder of the solution for which to restore packages.
Source Specifies a list of package sources to use.
Verbosity Specifies the amount of detail displayed in the output: normal, quiet, detailed (2.5+).
Version Specifies the version of the package to install.

Also see Environment variables

Examples

nuget install elmah

nuget install packages.config

nuget install ninject -OutputDirectory c:\proj