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 [OPTIONS] [COMMAND]

PARAMETERS

-h|--help
    Show help information

--info
    Display .NET installation information

--list-sdks
    List all installed .NET SDKs

--list-runtimes
    List all installed .NET runtimes

--version
    Display .NET SDK version

-v|--verbosity <LEVEL>
    Set verbosity: q|quiet, m|minimal, n|normal, d|etailed, diag|diagnostic

DESCRIPTION

.NET tools are specialized console applications packaged as NuGet packages for tasks like code generation, testing, and deployment. The dotnet tool command allows installing, uninstalling, listing, updating, searching, and restoring these tools either globally (user-wide) or locally (project-specific).

Global tools reside in ~/.dotnet/tools on Linux and require adding this path to $PATH for direct invocation. Local tools are stored in a project's tools folder and invoked via dotnet tool run or symlinks. This enables sharing tools across projects without global pollution.

Key benefits include version management per project, integration with dotnet restore, and discovery via NuGet.org. Tools like dotnet-ef (Entity Framework) or dotnet-ildasm exemplify usage. Always verify tool compatibility with your .NET SDK version.

CAVEATS

Global tools require ~/.dotnet/tools in $PATH; restart shell or source profile after install. Local tools need project config; avoid mixing global/local. Requires .NET SDK 2.1+. Prone to NuGet feed issues or permission errors on restricted systems.

SUBCOMMANDS

install: Install tool package.
uninstall: Remove tool.
list: List installed tools.
update: Update tool.
search: Search NuGet for tools.
restore: Restore local tools from manifest.

GLOBAL VS LOCAL

Use --global for user-wide install; omit for project-local. Global needs PATH update; local uses global.json or dotnet.tools.csproj.

HISTORY

Introduced in .NET Core 2.1 SDK (May 2018) for tool management. Evolved in .NET 5+ with better local tool support, manifest files, and NuGet integration. Now core to .NET 8+ workflows for CLI extensibility.

SEE ALSO

dotnet(1)

Copied to clipboard