update command (NuGet CLI)
Applies to: package consumption • Supported versions: all
Updates all packages in a project (using
packages.config) to their latest available versions. It is recommended to run 'restore' before running the
update. (To update an individual package, use
nuget install without specifying a version number, in which case NuGet installs the latest version.)
update does not work with the CLI running under Mono (Mac OSX or Linux) or when using the PackageReference format.
update command also updates assembly references in the project file, provided those references already exist. If an updated package has an added assembly, a new reference is not added. New package dependencies also don't have their assembly references added. To include these operations as part of an update, update the package in Visual Studio using the Package Manager UI or the Package Manager Console.
This command can also be used to update nuget.exe itself using the -self flag.
nuget update <configPath> [options]
<configPath> identifies either a
packages.config or solution file that lists the project's dependencies.
The NuGet configuration file to apply. If not specified,
~/.config/NuGet/NuGet.Config(Mac/Linux) is used.
-DependencyVersion [Lowest, HighestPatch, HighestMinor, Highest, Ignore]
Specifies the version of the dependency packages to use, which can be one of the following:
- Lowest (default): the lowest version
- HighestPatch: the version with the lowest major, lowest minor, highest patch
- HighestMinor: the version with the lowest major, highest minor, highest patch
- Highest: the highest version
- Ignore: No dependency packages will be used
-FileConflictAction [PromptUser, Overwrite, Ignore]
Specifies the default action when a file from a package already exists in the target project. Set to
Overwriteto always overwrite files. Set to
Ignoreto skip files.
PromptUseraction, the default, will prompt for each conflicting file unless
IgnoreAllis provided, which will apply to all remaining files.
(3.5+) Forces nuget.exe to run using an invariant, English-based culture.
Displays help information for the command.
Specifies a list of package IDs to update.
(4.0+) Specifies the path of MSBuild to use with the command, taking precedence over
(3.2+) Specifies the version of MSBuild to be used with this command. Supported values are 4, 12, 14, 15.1, 15.3, 15.4, 15.5, 15.6, 15.7, 15.8, 15.9. By default the MSBuild in your path is picked, otherwise it defaults to the highest installed version of MSBuild.
Suppresses prompts for user input or confirmations.
Allows updating to prerelease versions. This flag is not required when updating prerelease packages that are already installed.
Specifies the local folder where packages are installed.
Specifies that only updates with the highest version available within the same major and minor version as the installed package will be installed.
Updates nuget.exe to the latest version; all other arguments are ignored.
Specifies the list of package sources (as URLs) to use for the updates. If omitted, the command uses the sources provided in configuration files, see Common NuGet configurations.
Specifies the amount of detail displayed in the output:
When used with one package ID, specifies the version of the package to update.
Also see Environment variables
nuget update # update packages installed in solution.sln, using MSBuild version 14.0 to load the solution and its project(s). nuget update solution.sln -MSBuildVersion 14 nuget update -safe nuget update -self