Cake Build

Table of Contents

  1. How It Works
  2. File Pattern
  3. Task Definition Syntax
  4. Prerequisites
  5. Enabling / Disabling
  6. Next Steps

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


© 2026 Ryan Conrad. All rights reserved.

This site uses Just the Docs, a documentation theme for Jekyll.