Cake Build
Table of Contents
Cake (C# Make) is a cross-platform build automation tool that uses a C# DSL for defining build tasks. Cake scripts are .cake files and tasks are declared using the Task("TaskName") API.
Cake is installed as a .NET global or local tool and invoked via dotnet cake. No application path configuration is required โ Cake must be installed using the .NET package manager (dotnet tool install).
How It Works
The extension scans every *.cake file in the workspace and extracts any top-level Task("...") declarations. Each discovered task is surfaced as a runnable task. When executed, the extension calls:
dotnet cake <scriptFile> --target=<TaskName>
File Pattern
**/*.cake
Task Definition Syntax
Tasks in Cake are defined using the fluent Task() API:
Task("Clean")
.Does(() =>
{
CleanDirectory("./output");
});
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetBuild("./src/MyProject.sln");
});
Task("Default")
.IsDependentOn("Build");
RunTarget(target);
Both double-quoted and single-quoted task names are supported:
Task("Build") // โ
supported
Task('Build') // โ
supported
Prerequisites
Cake must be installed as a .NET tool. To install Cake globally:
dotnet tool install --global Cake.Tool
Or locally in your project (recommended):
dotnet tool install Cake.Tool
With a local installation, make sure a dotnet-tools.json manifest file is present in your .config/ directory and run dotnet tool restore to initialize the tool.
Enabling / Disabling
Use workspaceTasks.enabledTaskTypes to control whether Cake tasks are discovered:
{
"workspaceTasks.enabledTaskTypes": {
"cake": true
}
}
Next Steps
- Configuration Reference โ Full settings reference including task type toggles
- Task Runners โ Gulp, Grunt, Just, Make, mise, CMake, and more
- Enabling / Disabling Task Types โ Control which task types are active