A .NET tool is a special NuGet package that contains a console application. You can install a tool on your machine in the following ways.
The tool binaries are installed in a default directory that is added to the
PATH environment variable.
You can also install it as a global tool in a custom location (also known as a tool-path tool).
In .NET Core 3.0, local tools are introduced. The local tool applies to .NET Core SDK 3.0 and later. The tool binaries are installed in a default directory. You invoke the tool from the installation directory or any of its subdirectories.
Local tools are similar to global tools but are associated with a particular location on disk. Local tools are not available globally and are distributed as NuGet packages.
dotnet-tools.jsonin your current directory.
For both global and local tools, a compatible version of the runtime is required. Many tools currently on NuGet.org target .NET Core Runtime 2.1.
To install a tool for local access only for the current directory and subdirectories. It has to be added to a tool manifest file to create a tool manifest file, run the dotnet new tool-manifest command:
dotnet new tool-manifest
This command creates a manifest file named
dotnet-tools.json under the
.config directory. To add a local tool to the manifest file, use the dotnet tool install command and omit the
--tool-path options as shown below.
dotnet tool install dotnetsay
The command output shows which manifest file the newly installed tool is in, similar to the following example.
You can invoke the tool from this directory using the following command: dotnet tool run dotnetsay Tool 'dotnetsay' (version '2.1.4') was successfully installed. Entry is added to the manifest file /home/name/botsay/.config/dotnet-tools.json.