DEV Community

wk
wk

Posted on • Updated on

Create .NET Core 3 local tools without touching .csproj

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

Top comments (2)

Collapse
 
saint4eva profile image
saint4eva

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

Collapse
 
wearetherock profile image
wk

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