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 Core 3.1 SDK and later versions
Name
dotnet tool install - Installs the specified .NET tool on your machine.
Synopsis
dotnet tool install <PACKAGE_NAME> -g|--global
[--allow-downgrade] [--allow-roll-forward] [-a|--arch <ARCHITECTURE>]
[--add-source <SOURCE>] [--configfile <FILE>] [--disable-parallel]
[--framework <FRAMEWORK>] [--ignore-failed-sources] [--interactive]
[--no-cache] [--prerelease]
[--tool-manifest <PATH>] [-v|--verbosity <LEVEL>]
[--version <VERSION_NUMBER>]
dotnet tool install <PACKAGE_NAME> --tool-path <PATH>
[--allow-downgrade] [--allow-roll-forward] [-a|--arch <ARCHITECTURE>]
[--add-source <SOURCE>] [--configfile <FILE>] [--disable-parallel]
[--framework <FRAMEWORK>] [--ignore-failed-sources] [--interactive]
[--no-cache] [--prerelease]
[--tool-manifest <PATH>] [-v|--verbosity <LEVEL>]
[--version <VERSION_NUMBER>]
dotnet tool install <PACKAGE_NAME> [--local]
[--allow-downgrade] [--allow-roll-forward] [-a|--arch <ARCHITECTURE>]
[--add-source <SOURCE>] [--configfile <FILE>]
[--create-manifest-if-needed] [--disable-parallel]
[--framework <FRAMEWORK>] [--ignore-failed-sources] [--interactive]
[--no-cache] [--prerelease]
[--tool-manifest <PATH>] [-v|--verbosity <LEVEL>]
[--version <VERSION_NUMBER>]
dotnet tool install -h|--help
Description
The dotnet tool install command provides a way for you to install .NET tools on your machine. To use the command, you specify one of the following installation options:
- To install a global tool in the default location, use the
--globaloption. - To install a global tool in a custom location, use the
--tool-pathoption. - To install a local tool, omit the
--globaland--tool-pathoptions.
Warning
Make sure the directory you specify with the --tool-path option is secure. Tools installed in this location can be executed directly, so using an untrusted or shared path might introduce security risks.
Installation locations
Global tools
Global tools are installed in the following directories by default when you specify the -g or --global option:
| OS | Path |
|---|---|
| Linux/macOS | $HOME/.dotnet/tools |
| Windows | %USERPROFILE%\.dotnet\tools |
Executables are generated in these folders for each globally installed tool, although the actual tool binaries are nested deep into the sibling .store directory.
Note
On Linux after installing a command-line tool with dotnet tool, the tool can be executed only from the $HOME/.dotnet/tools path.
To make the tool executable from any directory, update the PATH environment variable.
To make the updated PATH environment variable permanent in your shell, update your shell settings.
For Bash, this is the $HOME/.bashrc file.
--tool-path tools
Tools with explicit tool paths are stored wherever you specified the --tool-path parameter to point to. They're stored in the same way as global tools: an executable binary with the actual binaries in a sibling .store directory.
Local tools
Local tools are stored in the NuGet global directory, whatever you've set that to be. There are shim files in $HOME/.dotnet/toolResolverCache for each local tool that point to where the tools are within that location.
References to local tools are added to a dotnet-tools.json file in a .config directory under the current directory. Starting in .NET 10, if a manifest file doesn't exist yet, one is created automatically. You can also create one manually by running the following command:
dotnet new tool-manifest
For more information, see Install a local tool.
Arguments
PACKAGE_NAMEName/ID of the NuGet package that contains the .NET tool to install.
Options
--allow-downgradeAllow package downgrade when installing or updating a .NET tool package. Suppresses the warning, "The requested version x.x.x is lower than existing version x.x.x."
--allow-roll-forwardAvailable starting with .NET 9.0 SDK. Allow tool to use a newer version of the .NET runtime if the runtime it targets isn't installed.
-a|--arch <ARCHITECTURE>Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a
win-x64machine, specifying--arch x86sets the RID towin-x86.
--add-source <SOURCE>Adds an additional NuGet package source to use during installation. Feeds are accessed in parallel, not sequentially in some order of precedence. If the same package and version is in multiple feeds, the fastest feed wins. For more information, see What happens when a NuGet package is installed?.
--configfile <FILE>The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. For more information, see Common NuGet Configurations.
--create-manifest-if-neededAvailable starting in .NET 8 SDK.
Applies to local tools. To find a manifest, the search algorithm searches up the directory tree for
dotnet-tools.jsonor a.configfolder that contains adotnet-tools.jsonfile.If a tool-manifest can't be found and the
--create-manifest-if-neededoption is set tofalse, theCannotFindAManifestFileerror occurs.If a tool-manifest can't be found and the
--create-manifest-if-neededoption is set totrue(or, in .NET 10 and later versions, when not specified), the tool creates a manifest automatically. It chooses a folder for the manifest as follows:- Walk up the directory tree searching for a directory that has a
.gitsubfolder. If one is found, create the manifest in that directory. - If the previous step doesn't find a directory, walk up the directory tree searching for a directory that has a
.slnor.gitfile. If one is found, create the manifest in that directory. - If neither of the previous two steps finds a directory, create the manifest in the current working directory.
For more information on how manifests are located, see Install a local tool.
Starting in .NET 10, a manifest is created automatically if no tools manifest is found. This change can be a breaking change. You can opt out by passing
--create-manifest-if-needed=false.Warning
Don't run tool commands from the Downloads folder or any shared location. The CLI walks up the directory tree to find a tool manifest, which might cause it to use a manifest you don't expect. Always run tool commands from a trusted, project-specific directory.
- Walk up the directory tree searching for a directory that has a
--disable-parallelPrevent restoring multiple projects in parallel.
--framework <FRAMEWORK>Specifies the target framework to install the tool for. By default, the .NET SDK tries to choose the most appropriate target framework.
-g|--globalSpecifies that the installation is user wide. Can't be combined with the
--tool-pathoption. Omitting both--globaland--tool-pathspecifies a local tool installation.--source <SOURCE>Specifies the source for NuGet packages. This source replaces all NuGet package sources.
-?|-h|--helpPrints out a description of how to use the command.
--ignore-failed-sourcesTreat package source failures as warnings.
--interactiveAllows the command to stop and wait for user input or action. For example, to complete authentication.
--localUpdate the tool and the local tool manifest. Can't be combined with the
--globaloption or the--tool-pathoption.--no-cacheor--no-http-cacheDon't cache packages and HTTP requests.
--prereleaseInclude prerelease packages.
--tool-manifest <PATH>Path to the manifest file.
--tool-path <PATH>Specifies the location to install the Global Tool. PATH can be absolute or relative. If PATH doesn't exist, the command tries to create it. Omitting both
--globaland--tool-pathspecifies a local tool installation.
-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.
--version <VERSION_NUMBER>The version of the tool to install. By default, the latest stable package version is installed. Use this option to install preview or older versions of the tool.
Starting with .NET 8,
--version Major.Minor.Patchrefers to a specific major/minor/patch version, including unlisted versions. To get the latest version of a certain major/minor version instead, use--version Major.Minor.*.
Examples
dotnet tool install -g dotnetsayInstalls dotnetsay as a global tool in the default location.
dotnet tool install dotnetsay --tool-path c:\global-toolsInstalls dotnetsay as a global tool in a specific Windows directory.
dotnet tool install dotnetsay --tool-path ~/binInstalls dotnetsay as a global tool in a specific Linux/macOS directory.
dotnet tool install -g dotnetsay --version 2.0.0Installs version 2.0.0 of dotnetsay as a global tool.
dotnet tool install dotnetsayInstalls dotnetsay as a local tool for the current directory.
dotnet tool install -g dotnetsay --verbosity minimalInstalls dotnetsay as a global tool with the verbosity of minimal. The default verbosity for global tool is quiet.
dotnet tool install -g dotnetsay --allow-roll-forwardInstalls dotnetsay as a global tool and allows it to run on newer .NET versions if the target runtime isn't available.