logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

This article applies to: ✔️ .NET Core 3.1 SDK and later versions

Arguments

<PATH|NUGET_ID>

         The  folder  on  the  file system or the NuGet package identifier to install the template package from.
         dotnetnew attempts to install the NuGet package from the NuGet sources available for the current work‐
         ing directory and the sources specified via the --add-source option.  If you want to install a specific
         version or prerelease version of a template package from NuGet source, specify the version in the  for‐
         mat <package-name>::<package-version>.

Description

       The  dotnetnewinstall command installs a template package from the PATH or NUGET_ID provided.  If you
       want to install a specific version or prerelease version of a template package, specify  the  version  in
       the  format  <package-name>::<package-version>.   By  default, dotnetnew passes * for the version, which
       represents the latest stable package version.  For more information, see the Examples section.

       If a version of the template package was already installed when you run this command, the template  pack‐
       age  will be updated to the specified version.  If no version is specified, the package is updated to the
       latest stable version.  Starting with .NET SDK 6.0.100, if the argument specifies the version,  and  that
       version  of  the  NuGet package is already installed, it won’t be reinstalled.  If the argument is a PATH
       and it’s already installed, it won’t be reinstalled.

       Prior to .NET SDK 6.0.100, template packages were managed individually for each .NET SDK version, includ‐
       ing patch versions.  For example, if you install the template package using dotnetnew--install in  .NET
       SDK  5.0.100, it will be installed only for .NET SDK 5.0.100.  Templates from the package won’t be avail‐
       able in other .NET SDK versions installed on your machine.

       Starting with .NET SDK 6.0.100, installed template packages are available in later .NET SDK versions  in‐
       stalled on your machine.  A template package installed in .NET SDK 6.0.100 will also be available in .NET
       SDK  6.0.101,  .NET  SDK 6.0.200, and so on.  However, these template packages won’t be available in .NET
       SDK versions prior to .NET SDK 6.0.100.  To use a template package installed in .NET SDK 6.0.100 or later
       in earlier .NET SDK versions, you need to install it using dotnetnewinstall in that .NET SDK version.

       Starting with the .NET 7 SDK, the dotnetnew syntax has changed:

       • The --list, --search, --install, and --uninstall options became list, search,  install,  and  uninstall
         subcommands.

       • The --update-apply option became the update subcommand.

       • To use --update-check, use the update subcommand with the --check-only option.

       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:  dotnetnew<subcommand>--help lists all supported options for the subcommand.

       Additionally,  tab completion is now available for dotnetnew.  It supports completion for installed tem‐
       plate names and for the options a selected template provides.  To activate tab completion  for  the  .NET
       SDK,  see  Enable  tab completion.  > > Examples of old syntax: > > - Install the latest version of Azure
       web jobs project template package: > > dotnetcli>dotnetnew--installMicrosoft.Azure.WebJobs.Pro‐jectTemplates>

Dotnet New Install

Thisarticleappliesto: ✔️ .NET Core 3.1 SDK and later versions

Examples

       • Install the latest version of SPA templates for ASP.NET Core:

                dotnet new install Microsoft.DotNet.Web.Spa.ProjectTemplates

       • Install version 2.0 of the SPA templates for ASP.NET Core:

                dotnet new install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0

       • Install version 2.0 of the SPA templates for ASP.NET Core from a custom NuGet source using  interactive
         mode:

                dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0 --add-source "https://api.my-custom-nuget.com/v3/index.json" --interactive

Name

       dotnet-new-install - installs a template package.

Options

--add-source|--nuget-source<SOURCE>

         By  default, dotnetnewinstall uses the hierarchy of NuGet configuration files from the current direc‐
         tory to determine the NuGet source the package can be installed from.  If --nuget-source is  specified,
         the source will be added to the list of sources to be checked.
         To  check  the configured sources for the current directory use dotnetnugetlistsource.  For more in‐
         formation, see Common NuGet Configurations

                Following NuGet’s Https Everywhere (https://devblogs.microsoft.com/nuget/https-everywhere/) ini‐
                tiative, dotnetnew is phasing out http feeds.  If an http feed is passed, it isn’t queried  for
                packages  and  a warning is displayed.  The --force option can be used to override this behavior
                if necessary.

       • -d|--diagnostics

         Enables diagnostic output.  Available since .NET SDK 7.0.100.

       • --force

         Allows installing template packages from the specified sources even if they would override  a  template
         package from another source.  Available since .NET SDK 7.0.100.

       • -h|--help

         Prints out help for the install command.  Available since .NET SDK 7.0.100.

       • --interactive

         Allows the command to stop and wait for user input or action.  For example, to complete authentication.
         Available since .NET 5.0 SDK.

       • -v|--verbosity<LEVEL>

         Sets  the  verbosity  level  of  the command.  Allowed values are q[uiet], m[inimal], n[ormal], and di‐ag[nostic].  Available since .NET SDK 7.0.100.

See Also

dotnetnew command

       • dotnetnewsearch command

       • Custom templates for dotnetnew

                                                   2024-10-02                              dotnet-new-install(1)

Synopsis

              dotnet new install <PATH|NUGET_ID>  [--interactive] [--add-source|--nuget-source <SOURCE>] [--force]
                  [-d|--diagnostics] [--verbosity <LEVEL>] [-h|--help]

See Also