LinuxCommandLibrary

dotnet-tool

Manage .NET global and local tools

TLDR

Install a global tool (don't use --global for local tools)

$ dotnet tool install [[-g|--global]] [dotnetsay]
copy

Install tools defined in the local tool manifest
$ dotnet tool restore
copy

Update a specific global tool (don't use --global for local tools)
$ dotnet tool update [[-g|--global]] [tool_name]
copy

Uninstall a global tool (don't use --global for local tools)
$ dotnet tool uninstall [[-g|--global]] [tool_name]
copy

List installed global tools (don't use --global for local tools)
$ dotnet tool list [[-g|--global]]
copy

Search tools in NuGet
$ dotnet tool search [search_term]
copy

Display help
$ dotnet tool [[-h|--help]]
copy

SYNOPSIS

dotnet tool command [options]

PARAMETERS

install
    Installs the specified .NET tool.

update
    Updates the specified .NET tool to the latest version.

uninstall
    Uninstalls the specified .NET tool.

list
    Lists all installed .NET tools.

restore
    Restores the local tools specified in the manifest file.

--global
    Specifies that the tool should be installed or listed globally.

--tool-path
    Specifies the location where the tool is installed.

--local
    Specifies that the tool should be installed or listed locally. Requires a tool manifest file.

--package
    Specifies the NuGet package ID of the tool.

--version
    Specifies the tool version to install.

--configfile
    The NuGet configuration file to use.

--add-source
    Adds an additional NuGet package source to use when installing the tool.

--framework
    Specifies the target framework to use when installing the tool.

--verbosity
    Sets the verbosity level of the command.

DESCRIPTION

The dotnet tool command is a powerful utility for managing .NET tools. It allows you to install, update, uninstall, and list both global and local tools. .NET tools are console applications that can be installed from NuGet packages and run from the command line. Global tools are accessible from any directory after installation, while local tools are specific to a project and are defined within a manifest file. The dotnet tool command simplifies the process of installing and managing these tools, which can range from code generators and linters to specialized utilities for specific .NET workloads. Using local tools allows for version control and consistency across team members working on the same project, as the tool versions are explicitly defined in the manifest.
The dotnet tool command allows to manage .NET Global Tools and Local Tools.
It is an essential command for .NET developers looking to extend their command-line capabilities with .NET tools.

CAVEATS

The dotnet tool command requires the .NET SDK to be installed. Local tools require a tool manifest file (dotnet new tool-manifest) in the project directory or a parent directory.

TOOL MANIFEST

A tool manifest file (.config/dotnet-tools.json) is a JSON file that lists the local tools for a project. You can create one using the dotnet new tool-manifest command.

EXIT CODES

The dotnet tool command returns 0 on success and a non-zero exit code on failure.

HISTORY

The dotnet tool command was introduced with the .NET Core SDK 2.1 as a way to manage command-line tools distributed as NuGet packages. Its purpose was to provide a centralized mechanism for installing, updating, and uninstalling tools, making it easier for developers to extend their command-line environment with .NET-based utilities. The feature has evolved over subsequent .NET SDK releases with improvements in local tool support and manifest-based management, enhancing the overall developer experience.

SEE ALSO

dotnet(1)

Copied to clipboard