.NET Tool

This is the recommended way to run Cake Scripts.

Requirements

The Cake.Tool NuGet package, is a .NET Core global tool compiled for .NET Core 2.1 or newer.

Usage

dotnet cake [script] [switches]

Switches

Switch Description Available Since
--verbosity=<value> Specifies the amount of information to be displayed (quiet, minimal, normal, verbose, diagnostic). 0.1.1
--debug Launches script in debug mode. 0.12.0
--showdescription Shows description about tasks. 0.1.10
--showtree, --tree Shows the task dependency tree. 0.31.0
--dryrun Performs a dry run. 0.2.0
--exclusive Execute a single task without any dependencies. 0.29.0
--version Displays version information. 0.1.12
--info Displays additional information about Cake execution. 0.31.0
--help Prints help information. 0.1.12

--target=<target> is not a switch of the runner, but a custom switch which scripts often implement to invoke a specific task.

Custom switches

All switches not recognized by Cake will be added to an argument list that is passed to the build script. See Arguments And Environment Variables how to read arguments in your script.

Bootstrapping for .NET Tool

The following instructions require .NET Core 3.0 or newer. See How to manage .NET Core tools for details and other options.

Setup

There's a one-time setup required for configuring a repository to use Cake .NET tool.

If you have .NET Tool already available in your environment you can skip the steps in this chapter.

Make sure to have a tool manifest available in your repository or create one using the following command:

dotnet new tool-manifest

Install Cake as a local tool using the dotnet tool command:

dotnet tool install Cake.Tool --version x.y.z

Running build script

Make sure tools are restored:

dotnet tool restore

Once installed, you can launch Cake using the .NET CLI:

dotnet cake

By convention this will execute the build script named build.cake. You can override this behavior by additionally passing the name of the build script.

Using pre-release versions

Cake uses Azure Artifacts as a NuGet feed for testing and pre-release builds. With these pre-release builds the next version of Cake can be accessed and utilized for getting the latest features or testing addins or build scripts to know if the next release will be safe when you need to upgrade.