Create .NET Core 3 local tools without touching .csproj

twitter logo ・1 min read

What is local tools

.NET Core 3.0 introduces local tools. Local tools are similar to global tools but are associated with a particular location on disk. Local tools aren't available globally and are distributed as NuGet packages.

Create project

dotnet new console --language C# --output sr/MyApp

Pack as tool

dotnet pack src/MyApp \
    /p:PackAsTool=true \
    /p:ToolCommandName=wk-my-app \
    /p:PackageId=wk.MyApp \
    /p:Version=0.0.1 \
    --output .publish

Install as local tool

dotnet new tool-manifest
dotnet tool install wk.MyApp \
    --add-source .publish

Execute

dotnet wk-my-ap

Uninstall

dotnet tool uninstall wk.MyApp
twitter logo DISCUSS (2)
markdown guide
 

I thought C# is the language by default? Do you need to specify the argument --language?

 

it more obvious when specify --language and easy to switch from C# to F#

Classic DEV Post from Apr 30

Who's looking for open source contributors? (April 30th edition)

wk profile image
.NET Developer