BT

InfoQ Homepage News Exploring Global Tools in .NET Core

Exploring Global Tools in .NET Core

Bookmarks

One of the new features to debut in .NET Core 2.1 Preview was Global Tools.  Global Tools provides a way to write .NET Core console apps that can be packaged and delivered as NuGet packages.  If .NET Core runs on the target platform, then a properly packaged Global Tool will work there.  JavaScript developers may find it interesting to note that this tooling is directly inspired by NPM global tools.

Ultimately .NET Core Global Tools will support installation into a user’s local directory, but in the current preview release a given tool must be installed globally for all users on the system.  Installation of a Global Tool is done via the following command:

dotnet install tool -g example

To remove an installed .NET Core tool, it must be manually deleted from its installation directory.  On Windows systems that is:

%USERPROFILE%\.dotnet\tools

On Linux systems that is:

    ~/.dotnet/tools

Microsoft has provided samples of a global tool in the dotnet repo, including dotnetsay which can be reviewed as a sample implementation.  For a bit more of an in-depth sample, Alexander Tsvetkov has put together a helpful walkthrough on to create a global tool from scratch.  This doubles as an example of why the global tool is helpful: in this case he puts together a simple static file web server that can be executed from any directory (which can be useful for development purposes).

Coming in future releases is the ability to install the tools in a single user profile and the ability to uninstall previously installed tools.  In reviewing what npm global tools offers, it would seem plausible that gaining the ability to update installed tools would also be forthcoming.

To try out Global Tools for yourself, .NET Core 2.1 Preview must be installed on your system.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.