1dotnet-new-install(1) .NET Documentation dotnet-new-install(1)
2
3
4
6 This article applies to: ✔️ .NET Core 3.1 SDK and later versions
7
9 dotnet-new-install - installs a template package.
10
12 dotnet new install <PATH|NUGET_ID> [--interactive] [--add-source|--nuget-source <SOURCE>] [--force]
13 [-d|--diagnostics] [--verbosity <LEVEL>] [-h|--help]
14
16 The dotnet new install command installs a template package from the
17 PATH or NUGET_ID provided. If you want to install a specific version
18 or prerelease version of a template package, specify the version in the
19 format <package-name>::<package-version>. By default, dotnet new pass‐
20 es * for the version, which represents the latest stable package ver‐
21 sion. For more information, see the Examples section.
22
23 If a version of the template package was already installed when you run
24 this command, the template package will be updated to the specified
25 version. If no version is specified, the package is updated to the
26 latest stable version. Starting with .NET SDK 6.0.100, if the argument
27 specifies the version, and that version of the NuGet package is already
28 installed, it won’t be reinstalled. If the argument is a PATH and it’s
29 already installed, it won’t be reinstalled.
30
31 Prior to .NET SDK 6.0.100, template packages were managed individually
32 for each .NET SDK version, including patch versions. For example, if
33 you install the template package using dotnet new --install in .NET SDK
34 5.0.100, it will be installed only for .NET SDK 5.0.100. Templates
35 from the package won’t be available in other .NET SDK versions in‐
36 stalled on your machine.
37
38 Starting with .NET SDK 6.0.100, installed template packages are avail‐
39 able in later .NET SDK versions installed on your machine. A template
40 package installed in .NET SDK 6.0.100 will also be available in .NET
41 SDK 6.0.101, .NET SDK 6.0.200, and so on. However, these template
42 packages won’t be available in .NET SDK versions prior to .NET SDK
43 6.0.100. To use a template package installed in .NET SDK 6.0.100 or
44 later in earlier .NET SDK versions, you need to install it using dotnet
45 new install in that .NET SDK version.
46
47 Starting with the .NET 7 SDK, the dotnet new syntax has changed:
48
49 • The --list, --search, --install, and --uninstall options became list,
50 search, install and uninstall subcommands.
51
52 • The --update-apply option became the update subcommand.
53
54 • To use --update-check, use the update subcommand with the --check-on‐
55 ly option.
56
57 Other options that were available before are still available to use
58 with their respective subcommands. Separate help for each subcommand
59 is available via the -h or --help option: dotnet new <subcommand>
60 --help lists all supported options for the subcommand.
61
62 Additionally, tab completion is now available for dotnet new. It sup‐
63 ports completion for installed template names and for the options a se‐
64 lected template provides. To activate tab completion for the .NET SDK,
65 see Enable tab completion. > > Examples of old syntax: > > - Install
66 the latest version of Azure web jobs project template package: > > dot‐
67 netcli > dotnet new --install Microsoft.Azure.WebJobs.ProjectTem‐
68 plates >
69
71 • <PATH|NUGET_ID>
72
73 The folder on the file system or the NuGet package identifier to in‐
74 stall the template package from. dotnet new attempts to install the
75 NuGet package from the NuGet sources available for the current work‐
76 ing directory and the sources specified via the --add-source option.
77 If you want to install a specific version or prerelease version of a
78 template package from NuGet source, specify the version in the format
79 <package-name>::<package-version>.
80
82 • --add-source|--nuget-source <SOURCE>
83
84 By default, dotnet new install uses the hierarchy of NuGet configura‐
85 tion files from the current directory to determine the NuGet source
86 the package can be installed from. If --nuget-source is specified,
87 the source will be added to the list of sources to be checked.
88 To check the configured sources for the current directory use dotnet
89 nuget list source. For more information, see Common NuGet Configura‐
90 tions
91
92 • -d|--diagnostics
93
94 Enables diagnostic output. Available since .NET SDK 7.0.100.
95
96 • --force
97
98 Allows installing template packages from the specified sources even
99 if they would override a template package from another source.
100 Available since .NET SDK 7.0.100.
101
102 • -h|--help
103
104 Prints out help for the install command. Available since .NET SDK
105 7.0.100.
106
107 • --interactive
108
109 Allows the command to stop and wait for user input or action. For
110 example, to complete authentication. Available since .NET 5.0 SDK.
111
112 • -v|--verbosity <LEVEL>
113
114 Sets the verbosity level of the command. Allowed values are q[uiet],
115 m[inimal], n[ormal], and diag[nostic]. Available since .NET SDK
116 7.0.100.
117
119 • Install the latest version of SPA templates for ASP.NET Core:
120
121 dotnet new install Microsoft.DotNet.Web.Spa.ProjectTemplates
122
123 • Install version 2.0 of the SPA templates for ASP.NET Core:
124
125 dotnet new install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0
126
127 • Install version 2.0 of the SPA templates for ASP.NET Core from a cus‐
128 tom NuGet source using interactive mode:
129
130 dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0 --add-source "https://api.my-custom-nuget.com/v3/index.json" --interactive
131
133 • dotnet new command
134
135 • dotnet new search command
136
137 • Custom templates for dotnet new
138
139
140
141 2022-11-08 dotnet-new-install(1)