what is. NET Core Global Tools?
Global Tools is one of the first features in. NET Core 2.1. Global Tools provides a way for a developer to write a. NET core app that can be packaged as a NuGet package delivery. If the. NET core is running on the target platform, then a properly packaged global tool can run on it. One interesting thing that JavaScript developers might find is that this tool is a direct reference to NPM Global tools.
The Setup (tool) commands are as follows:
dotnet Install Tool-g Dotnetsay
To uninstall a program (tool) that is already installed:
dotnet Tool Uninstall-g Dotnetsay
To view the installed programs (tools):
dotnet Tool List-g
How do I pack a program tool?
- Create a new Console project
- New plus ispackable and Packastool nodes, with a value of true
<project sdk= "MICROSOFT.NET.SDK" > <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp2.1</TargetFramework> <generatepackageonbuild>true</ generatepackageonbuild> <IsPackable>true</IsPackable> <packastool>true</ packastool> </PropertyGroup></Project>
- After the compilation project is complete, you can see the xxx.1.0.0.nupkg in Bin\Debug
- Upload to nuget.org, need a small audit time, upload completed as follows
please start your show!
Open the command line and run:
dotnet Tool Install--global Lewissayhello
Test Program (tool)
[Early adopters] mom doesn't have to worry anymore. Dotnet Core program released:. NET core Global Tools