dotnet tool exec command - .NET CLI (original) (raw)

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

Name

dotnet tool exec - Downloads and invokes a .NET tool without permanently installing it.

Synopsis

dotnet tool exec <PACKAGE_NAME>[@<VERSION>]
    [--allow-roll-forward] [-a|--arch <ARCHITECTURE>]
    [--add-source <SOURCE>] [--configfile <FILE>] [--disable-parallel]
    [--framework <FRAMEWORK>] [--ignore-failed-sources] [--interactive]
    [--no-http-cache] [--prerelease] [--source <SOURCE>]
    [-v|--verbosity <LEVEL>]
    [--] [<tool-arguments>...]

dotnet tool exec -h|--help

Description

The dotnet tool exec command provides a one-shot tool invocation mode for .NET Tools. It automatically downloads the specified tool package to the NuGet cache and invokes it without modifying your system PATH or requiring permanent installation.

When you run dotnet tool exec, the command:

  1. Checks the version (or version range) you specify (or the latest version if none is specified) against your configured NuGet feeds to decide which package to download.
  2. Downloads the specified package to the NuGet cache (if not already present).
  3. Invokes the tool with any provided arguments.
  4. Returns the tool's exit code.

dotnet tool exec works seamlessly with both global and local tools. If you have a local tool manifest available, it uses the manifest to determine which version of the tool to run.

This command also exists in two other forms for easier use

Arguments

Options

Examples

Comparison with other commands

This command is intended to be a unified way to work with .NET Tools. While the previously available tool installation commands remain available, dotnet tool exec provides a simpler and more flexible experience for most users.

Command Purpose Installation Scope
dotnet tool exec One-shot execution None (cached only) Temporary
dotnet tool install -g Permanent global installation Global System-wide
dotnet tool install Permanent local installation Local manifest Project
dotnet tool run Run an already-installed local tool Requires prior installation Project

The dotnet tool install -g command does still serve an important purpose for users who want to permanently install a tool. However, for users who want to try out a tool or run it in a CI/CD pipeline, dotnet tool exec is often a better fit.

See also