My Digital Garden

DotNet global tool

Install and use .NET global tools

Summary

I think probably the most useful use of DotNet Tools is as way of delivering Personal Software Tools, as once installed they can be used from any folder on your machine.

See also

Source Link

Note captured: 08/07/2022

Bookmark created: 08/07/2022

Highlights from source page

Install and use a global tool from Nuget

assumes tool you want has been published to Nuget

dotnet tool install --global <toolname>

The --global parameter tells the .NET CLI to install the tool binaries in a default location that is automatically added to the PATH environment variable.

Install and use a global tool from local source

Install the tool from a local the package by running the dotnet tool install command in a project folder:

dotnet tool install --global --add-source <project nupkg folder> <toolname>

The --global parameter tells the .NET CLI to install the tool binaries in a default location that is automatically added to the PATH environment variable.
The --add-source parameter tells the .NET CLI to temporarily use the ./nupkg directory as an additional source feed for NuGet packages. You gave your package a unique name to make sure that it will only be found in the ./nupkg directory, not on the Nuget.org site.

Invoke the tool

<toolname>

Update the tool to a later version from Nuget

dotnet tool update -g <toolname>

Remove the tool

dotnet tool uninstall -g <toolname>