Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article applies to: ✔️ .NET 6 SDK and later versions
Name
dotnet new update - updates installed template packages.
Synopsis
dotnet new update [--interactive] [--add-source|--nuget-source <SOURCE>]
[-d|--diagnostics] [--verbosity <LEVEL>] [-h|--help]
dotnet new update --check-only|--dry-run [--interactive] [--add-source|--nuget-source <SOURCE>]
[-d|--diagnostics] [--verbosity <LEVEL>] [-h|--help]
Description
The dotnet new update command updates installed template packages.
The dotnet new update command with --check-only option checks for available updates for installed template packages without applying them.
Note
Starting with the .NET 7 SDK, the dotnet new syntax has changed:
- The
--list,--search,--install, and--uninstalloptions becamelist,search,install, anduninstallsubcommands. - The
--update-applyoption became theupdatesubcommand. - To use
--update-check, use theupdatesubcommand with the--check-onlyoption.
Other options that were available before are still available to use with their respective subcommands.
Separate help for each subcommand is available via the -h or --help option: dotnet new <subcommand> --help lists all supported options for the subcommand.
Additionally, tab completion is now available for dotnet new. It supports completion for installed template names and for the options a selected template provides.
To activate tab completion for the .NET SDK, see Enable tab completion.
Examples of the old syntax:
Show help for the
updatesubcommand.Check for updates for installed template packages:
dotnet new --update-checkUpdate installed template packages:
dotnet new --update-apply
Options
-
--interactiveAllows the command to stop and wait for user input or action. For example, to complete authentication.
--add-source|nuget-source <SOURCE>By default,
dotnet new installuses the hierarchy of NuGet configuration files from the current directory to determine the NuGet source the package can be installed from. If--nuget-sourceis specified, the source will be added to the list of sources to be checked.
To check the configured sources for the current directory usedotnet nuget list source. For more information, see Common NuGet Configurations. Available since .NET SDK 7.0.100.--check-only|--dry-run
Only checks for updates and displays the template packages to be updated, without applying any updates.
-d|--diagnosticsEnables diagnostic output. Available since .NET SDK 7.0.100.
-
-?|-h|--helpPrints out a description of how to use the command.
-
-v|--verbosity <LEVEL>Sets the verbosity level of the command. Allowed values are
q[uiet],m[inimal],n[ormal],d[etailed], anddiag[nostic]. For more information, see LoggerVerbosity.
Examples
Updates the installed template packages using NuGet configuration for the current directory:
dotnet new updateUpdates the installed template packages also checking a custom NuGet source using interactive mode:
dotnet new update --add-source "https://api.my-custom-nuget.com/v3/index.json" --interactive