Cake v7.0.0 released

Published
Tuesday, 10 November 2026
Category
Release Notes
Author
devlead

Version 7.0.0 of Cake has been released. Take it for a spin and give us feedback on our discussion board.

This release includes new features, improvements and bug fixes to Cake Scripting, Cake Frosting and Cake Sdk since the Cake v6.3.0 release! 🚀 🍰

Highlights of this release

  • .NET 11 & C# 15 support — Cake now runs on .NET 11 and .NET 10 with C# 15 scripting support; .NET 8 and .NET 9 are no longer supported for running Cake itself.
  • One container, one host — Cake.Tool has moved from Autofac to Microsoft.Extensions.DependencyInjection, and the ServiceProvider alias gives you the same DI experience across Cake .NET Tool, Cake Frosting and Cake.Sdk.
  • Unified dependency graph by default — When running multiple targets, shared dependencies now only execute once.
  • Tools on demand — New InstallTool / InstallTools aliases let you install tools from within a task, only when they're actually needed.
  • DSL improvements — IsDependentOn / IsDependeeOf with multiple tasks, async DoesForEach (including IAsyncEnumerable), IFile content extensions aligned with System.IO.File, and GetFileSystemInfos.
  • New aliases — Tar / Untar, DotNetRunCode, DotNetUpdatePackage, DotNetSlnMigrate, DotNetProjectConvert, DotNetDownloadPackage, DotNetNuGetWhy and DotNetNuGetLocals, plus new .NET 11 settings for DotNetRun, DotNetTest and DotNetFormat.
  • Container publishing — DotNetPublish can now produce container images, pushed to a registry, loaded into a local Docker / Podman / WSL container engine, or saved as a tarball.
  • .NET 11 process APIs — Kill child processes when Cake exits, fire-and-forget processes, discard output, and pipe content to standard input.
  • GitHub Actions to Azure without secrets — The new AzureLogin command exchanges a GitHub Actions OIDC token for an Azure access token.
  • Cake.Template cakeci template — Scaffold a minimal CI pipeline running your Cake file-based build for eight different CI providers.
  • Addin recommended Cake version set to 7.0.0
  • Bug fixes, dependency and SDK updates

.NET 11 support & C# 15 support

Cake now fully supports running on .NET 11, and with this C# 15, which means you can take advantage of the latest framework, runtime, and language improvements (#4998, #4999). When running on .NET 11, Cake is also built with the new .NET 11 runtime async enabled (#5177).

Cake itself will no longer run on .NET 8 or .NET 9 (#4997), but Cake will continue to support building projects targeting .NET 9, .NET 8, older versions of .NET and .NET Framework.

The supported platform matrix for Cake 7.0.0 will look like this:

Runner .NET 11 .NET 10
Cake .NET Tool
Cake Frosting
Cake.Sdk

Cake.Template now defaults to net11.0.

Breaking changes

As with every major release, we've taken the opportunity to clean things up. Most builds should just work, but these are the changes worth knowing about:

  • .NET 8 & .NET 9 dropped — Cake now targets net10.0 and net11.0 (#4997, generator#206).
  • Unified dependency graph is now the default — See below for details and how to opt out (#5060).
  • Tri-state DotNet switches — Switches where the .NET CLI picks a default based on the environment are now bool?, so you can explicitly opt out. This affects Interactive on DotNetRestoreSettings, DotNetReferenceAddSettings, DotNetProjectConvertSettings, DotNetWorkloadInstallSettings and DotNetWorkloadRestoreSettings, and CreateManifestIfNeeded on DotNetToolInstallSettings. null (default) leaves it to the .NET CLI, true / false are passed on explicitly, i.e. --interactive false (#5169).
  • Autofac replaced by Microsoft.Extensions.DependencyInjection in Cake.Tool (#2835). Modules registering through ICakeContainerRegistrar keep working as before.
  • Obsolete members removed (#5003) and Spectre.Console.Cli updated to 0.57.2 (#5079).
  • Cake.Sdk — The generated public Program.ServiceProvider is gone in favour of the Cake.Common ServiceProvider alias, so replace any Program.ServiceProvider with ServiceProvider or Context.ServiceProvider (generator#203). Likewise, the generated InstallTool helpers are replaced by the Cake.Common aliases, existing InstallTool(...) calls keep working, but Program.IToolInstaller references should use Cake.Core.Tooling.IToolInstaller (generator#201).

One container, one host

With Cake.Tool migrated from Autofac to Microsoft.Extensions.DependencyInjection (#2835), all three runners now share the same DI container, and the ServiceProvider alias that Cake.Sdk users already know is now available on ICakeContext everywhere.

That means services registered by a module loaded with the #module directive can be resolved straight from your script:

#module nuget:?package=Cake.MyService.Module&version=1.0.0

Task("MyTask")
    .Does(() =>
{
    ServiceProvider
        .GetRequiredService<IMyService>()
        .DoWork();
});

RunTarget("MyTask");

The very same module works with Cake Frosting, where you also get constructor injection into your tasks:

return new CakeHost()
    .UseModule<MyServiceModule>()
    .ConfigureServices(services =>
        services.AddSingleton<IOtherService, OtherService>())
    .Run(args);

public sealed class MyTask(IMyService myService) : FrostingTask<FrostingContext>
{
    public override void Run(FrostingContext context)
    {
        myService.DoWork();
        context.ServiceProvider
            .GetRequiredService<IOtherService>()
            .DoWork();
    }
}

Cake.Sdk now also runs on the same BuildScriptHost as Cake .NET Tool (generator#208), so settings and behavior are identical regardless of runner. On the topic of consistency, Cake Frosting no longer exits with -1 for any kind of error; it now returns the CakeException.ExitCode (1 by default), just like the other runners (#3830, generator#207).

Unified dependency graph by default

In Cake 6.2.0 we introduced an opt-in unified dependency graph when running multiple targets, so dependencies shared between targets only execute once. In Cake 7.0.0 this is now the default (#5060).

dotnet cake --target=Test --target=Pack

Above, a shared Build dependency will now execute once, not once per target. If you rely on the previous behavior, you can opt out via argument

dotnet cake --target=Test --target=Pack --Settings_UnifiedDependencyGraphForMultipleTargets=false

or via cake.config

[Settings]
UnifiedDependencyGraphForMultipleTargets=false

Tools on demand & DSL improvements

#tool directives install tools up front, before your build runs. With the new InstallTool / InstallTools aliases (#2471) you can install tools from within a task, only when that task actually executes. This works with all runners.

Task("GitVersion")
    .Does(() =>
{
    InstallTool("dotnet:?package=GitVersion.Tool&version=6.8.2");
    // ...
});

The DSL also received a few quality of life improvements:

var unit = Task("Unit");
var integration = Task("Integration");

Task("Test")
    // Depend on multiple tasks, by builder or by name (#1462)
    .IsDependentOn([unit, integration])
    // Async DoesForEach, also supports IAsyncEnumerable (#5129)
    .DoesForEach(
        GetFiles("./artifacts/*.trx"),
        async trx =>
        {
            // IFile content extensions aligned with System.IO.File (#5081)
            var xml = await Context.FileSystem
                                .GetFile(trx)
                                .ReadAllTextAsync();

            Information($"{trx.GetFilename()}: {xml.Length} chars");
        });
  • IsDependentOn and IsDependeeOf accept multiple task names or task builders (#1462).
  • DoesForEach has async overloads, including IAsyncEnumerable<T> (#5129).
  • IFile has content read / write extensions mirroring System.IO.File, i.e. ReadAllText, ReadAllLines, WriteAllText, AppendAllLines, and their async counterparts (#5081).
  • GetFileSystemInfos lets you glob both files and directories in one go (#4660).

New aliases

Cake 7.0.0 comes with a bunch of new aliases:

// Create and extract tar archives (#5087)
Tar("./publish", "publish.tar.gz", new TarSettings {
    Compression = TarCompression.GZip
});
Untar("publish.tar.gz", "./publish");

// Update vulnerable packages (#5089)
DotNetUpdatePackage(new DotNetPackageUpdateSettings {
    Project = "./src/App.csproj",
    Vulnerable = true
});

// Migrate .sln to .slnx (#5105)
DotNetSlnMigrate("./src/HelloWorldApp.sln");

// Convert a file-based app to a project (#5107)
DotNetProjectConvert("./scripts/tool.cs");

// Run C# code via dotnet run - (#5127)
DotNetRunCode("""
    Console.WriteLine("Hello from dotnet run -");
    """);

Also new are DotNetDownloadPackage (#5103), DotNetNuGetWhy (#5109) and DotNetNuGetLocalsList / DotNetNuGetLocalsClear (#5112), together with new .NET 11 settings for DotNetRun (#5115), Microsoft Testing Platform settings for DotNetTest (#5119) and Framework for DotNetFormat (#5117).

Container publishing

DotNetPublish now supports publishing container images (#5159, #5173), either through the new Container settings or the convenience extension methods:

// Push to a container registry
DotNetPublish("./src/App/App.csproj", new DotNetPublishSettings()
    .WithContainerRegistry("ghcr.io", "devlead/app", "latest"));

// Load into local Docker, Podman or WSL container engine
DotNetPublish("./src/App/App.csproj", new DotNetPublishSettings()
    .WithContainerLocalRegistry(DotNetContainerLocalRegistry.Podman, "app")
    .WithContainerBaseImage("mcr.microsoft.com/dotnet/runtime:11.0"));

// Save as a tarball
DotNetPublish("./src/App/App.csproj", new DotNetPublishSettings()
    .WithContainerArchive("./artifacts/app.tar.gz"));

And as Cake.Sdk builds are regular .NET apps, you can publish your Cake build itself as a container, ready to run in any CI or container environment:

dotnet publish cake.cs \
  -t:PublishContainer \
  -p:ContainerBaseImage='mcr.microsoft.com/dotnet/sdk:11.0-resolute-aot' \
  -p:ContainerUser=root \
  -p:ContainerRepository=cake-sdk \
  -p:LocalRegistry=Docker

.NET 11 process APIs

When Cake runs on .NET 11, ProcessSettings can opt in to the new .NET 11 process APIs on a per process basis (#5085), i.e. KillOnParentExit, StartDetached, RestrictInheritedHandles, DiscardStandardOutput and DiscardStandardError, and there's a new StartProcessAndForget alias returning the process id.

var dotnet = Context.Tools.Resolve("dotnet.exe")
             ?? Context.Tools.Resolve("dotnet");

var processId = StartProcessAndForget(dotnet, "--version");
Information("Process ID: {0}", processId);

var exitCode = StartProcess(
    dotnet,
    new ProcessSettings {
        Arguments = "--version",
        KillOnParentExit = true,
        RestrictInheritedHandles = true,
        DiscardStandardOutput = true,
        DiscardStandardError = true
    });

Regardless of .NET version, you can now also pass standard input to a process (#5125), as a string or bytes:

var exitCode = StartProcess(
    dotnet,
    new ProcessSettings {
        Arguments = "run -",
        StandardInput = """
            Console.Write("Hello from stdin");
            """
    });

GitHub Actions to Azure without secrets

Building on the NuGetLogin trusted publishing support from Cake 6.3.0, Cake 7.0.0 adds AzureLogin (#5070), which exchanges a GitHub Actions OIDC token for an Azure access token. No Azure CLI and no client secret needed:

Task("Deploy")
    .Does(async () =>
{
    var accessToken = await GitHubActions.Commands.AzureLogin(
        EnvironmentVariable("AZURE_TENANT_ID"),
        EnvironmentVariable("AZURE_CLIENT_ID"));

    // ...deploy using Azure SDK / tools
});

If you're using Azure.Identity, AzurePrepareWorkloadIdentity writes a federated token file that WorkloadIdentityCredential / DefaultAzureCredential picks up:

var workload = await GitHubActions.Commands.AzurePrepareWorkloadIdentity(
    EnvironmentVariable("AZURE_TENANT_ID"),
    EnvironmentVariable("AZURE_CLIENT_ID"));

DotNetRun("./src/Deploy", new DotNetRunSettings {
    EnvironmentVariables = {
        ["AZURE_TENANT_ID"] = workload.TenantId,
        ["AZURE_CLIENT_ID"] = workload.ClientId,
        ["AZURE_FEDERATED_TOKEN_FILE"] = workload.FederatedTokenFile.FullPath
    }
});

Your workflow needs the id-token: write permission for the token request to succeed.

Cake.Template cakeci template

Cake.Template has a new cakeci template (generator#255), which scaffolds a minimal CI pipeline running your Cake file-based build:

dotnet new install Cake.Template

dotnet new cakeci --Provider github
dotnet new cakeci --Provider github --OS matrix
dotnet new cakeci --Provider azuredevops
dotnet new cakeci --Provider gitlab --Framework net10.0

Supported providers are github, azuredevops, bitbucket, gitlab, appveyor, woodpecker, rwx and bitrise.

We've now set the recommended version of Cake.Core for addins to target to 7.0.0 (#5001).

This won't break the build, but you might see warnings like the one below when addins or modules are loaded.

The assembly 'Cake.Addin, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'
is referencing an older version of Cake.Core (6.0.0).
For best compatibility it should target Cake.Core version 7.0.0.

The recommended target framework monikers for addins are now:

  • net11.0
  • net10.0

...and more

This release also includes a lot of smaller improvements and fixes: interpolated strings now correctly bind to the FormattableString log overloads (#5155, generator#258), using declarations on the first line are no longer hoisted as using alias directives (#5157), GetSpecialPath maps correctly on Unix (#5095), legacy .NET Framework / CoreCLR host code has been removed and internals modernized with frozen collections, GeneratedRegex and System.Text.Json, and the API docs now include Cake DSL examples (#5024, #5026, #5028, #5030).

Contributors

This release was made possible thanks to the Cake team and the contribution of these awesome members of the Cake community listed below:

Full details of everything that was included in this release can be seen below.

Issues

Cake

As part of this release we had Cake 106 issues closed.

Breaking change

  • #5169 Make environment-defaulted DotNet switches tri-state to allow explicit opt-out.
  • #5079 Update Spectre.Console.Cli to 0.57.2.
  • #5060 Make unified dependency graph the default when running multiple targets.
  • #5003 Remove obsolete members / methods.
  • #5001 Update LatestPotentialBreakingChange to 7.0.0.
  • #4997 Remove Unsupported TFMS .NET 8 & 9 (net8.0 & net9.0).
  • #2835 Migrate Cake.Tool from Autofac to Microsoft.Extensions.DependencyInjection.

Feature

  • #5187 Update .NET SDK to 11.0.100.
  • #5159 Add container publishing support to DotNetPublish.
  • #5127 Add DotNetRunCode aliases for dotnet run -.
  • #5125 Add ProcessSettings.StandardInput for StartProcess.
  • #5115 Add .NET 11 DotNetRun settings (environment, file, device, artifacts-path, no-cache).
  • #5112 Add DotNetNuGetLocalsList and Clear aliases.
  • #5109 Add DotNetNuGetWhy aliases for package dependency graphs.
  • #5107 Add DotNetProjectConvert aliases for file-based apps.
  • #5105 Add DotNetSlnMigrate aliases for sln to slnx.
  • #5103 Add DotNetDownloadPackage aliases for dotnet package download.
  • #5089 Add DotNetUpdatePackage aliases for dotnet package update.
  • #5087 Add Tar and Untar aliases for creating and extracting tar archives.
  • #5085 Add opt-in .NET 11 Process API support to Cake.
  • #5081 Add IFile content read/write extensions aligned with System.IO.File.
  • #5070 Add GitHub Actions AzureLogin for OIDC.
  • #5066 Drop dead runtime checks and Task.Run wrappers.
  • #4999 C# 15 Scripting Support.
  • #4998 Add .NET 11 (net11.0) TFM.
  • #4660 Consider adding IFileSystemInfo returning APIs in addition to IFile and IDirectory.
  • #2471 Install a nuget tool on demand.
  • #1269 Request for Task.Tool("nuget:?package=etc") .

Improvement

  • #5189 Update Basic.Reference.Assemblies.* to 1.8.15.
  • #5185 Update Microsoft.Extensions.DependencyInjection to 10.0.15 (net10.0) & 11.0.0 (net11.0).
  • #5183 Update System.Security.Cryptography.Pkcs to 10.0.15 (net10.0) & 11.0.0 (net11.0).
  • #5181 Update Basic.Reference.Assemblies.* to 1.8.14.
  • #5177 Enable .NET 11 runtime async for net11.0 builds.
  • #5175 Render --description task list as a Spectre.Console table.
  • #5173 Add base image support to DotNetPublish container settings extensions.
  • #5164 Update Basic.Reference.Assemblies.* to 1.8.13.
  • #5163 Update System.Security.Cryptography.Pkcs to 10.0.14 (net10.0) & 11.0.0-rc.3.26522.148 (net11.0).
  • #5162 Update Microsoft.Extensions.DependencyInjection to 10.0.14 (net10.0) & 11.0.0-rc.3.26522.148 (net11.0).
  • #5134 Update System.Security.Cryptography.Pkcs to 11.0.0-rc.2.26504.105 (net11.0).
  • #5133 Update Microsoft.Extensions.DependencyInjection to 11.0.0-rc.2.26504.105 (net11.0).
  • #5131 System.Security.Cryptography.Pkcs 10.0.12 has a known severity.
  • #5129 Add async DoesForEach and IAsyncEnumerable overloads.
  • #5119 Add .NET 11 DotNetTest MTP settings.
  • #5117 Add DotNetFormat Framework setting.
  • #5093 Drop leftover CoreCLR / NETFRAMEWORK host branches.
  • #5091 Remove Framework-era host fallbacks now that Cake targets net10/net11 only.
  • #5072 Stop embedding Microsoft.NETCore.Platforms; resolve #addin assets with the portable RID graph.
  • #5068 Freeze the NuGet deny list and drop unused Rider/xUnit leftovers.
  • #5064 Follow-up: FrozenDictionary and GeneratedRegex.
  • #5062 Modernize remaining CoreCLR polyfill internals.
  • #5058 Use Length and Frozen/GeneratedRegex for engine hygiene/perf.
  • #5056 Handle empty Assembly.Location in CakeRunner and VersionResolver.
  • #5054 Migrate GoCD history JSON to System.Text.Json.
  • #5052 Use SHA256.HashData instead of static shared HashAlgorithm instance.
  • #5050 Remove dead TFM conditionals after net10.0/net11.0 cut.
  • #5036 Update Basic.Reference.Assemblies.* to 1.8.12.
  • #5035 Update Microsoft.IdentityModel.JsonWebTokens to 8.23.0.
  • #5019 Add missing Azure Pipelines System.PullRequest predefined variables.
  • #4231 MsBuild Path for BuildTools is not recognized correctly.
  • #2413 TFBuildCommand PublishTestResults API Change.
  • #2373 Add method to ProcessArgumentBuilder class to insert argument at any location.
  • #1462 IsDependentOn with multiple tasks.
  • #1461 Non-formatting ICakeConsole.WriteLine overload.
  • #1367 A comment precisely constructed with a hyperlink immediately after the // on the same line as your #addin preprocessor directive when just using the Package Name causes nuget to fail to find the package.
  • #1272 Improper quoting of all command line arguments.

Documentation

  • #5030 Add Cake DSL examples to ICakeContext, IFileSystem, ProcessArgumentBuilder, and ToolSettings.
  • #5028 Add Cake DSL examples to Task, Does, and CakeTaskBuilder.
  • #5026 Add a Cake DSL example to GetCallerInfo.
  • #5024 Add Cake DSL examples to BuildSystem and CI provider APIs.

Bug

  • #5157 Using declarations without parentheses on the first line are hoisted as using alias directives.
  • #5155 Interpolated strings bind to string log overloads instead of FormattableString overloads.
  • #5095 Fix Unix GetSpecialPath HOME and Program Files mapping.
  • #3830 [Cake.Frosting] has exit code -1 for any kind of error.
  • #3829 Error: Error getting value from 'CurrentUser' on 'Cake.Core.IO.WindowsRegistry'.
  • #2646 Incorrect translation of literal constants used as optional parameter values (when constants are defined in a separate file).

Generator

As part of this release we had Generator 45 issues closed.

Feature

  • #293 Update Cake.* to 7.0.0.

Breaking Change

  • #206 Drop net8.0 and net9.0; add net11.0 for Cake.Sdk.
  • #205 Bump Cake.* to 7.0.0-alpha0105.
  • #203 Cake 7.0: drop generated public Program.ServiceProvider; use Cake.Common alias (and optionally Cake.Cli UseModule).
  • #201 Remove generated InstallTool helpers; use Cake.Common aliases (Cake 7.0).

Improvement

  • #288 Update Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers to 18.13.37903.2.
  • #264 Update .NET SDK to 11.0.100-rc.3.
  • #260 Cake.Common.Build types like BuildProvider aren't available without a manual using.
  • #255 Add cakeci template for minimal CI pipelines running a Cake file-based build.
  • #250 Update cakefile example project to xunit v3 on Microsoft.Testing.Platform.
  • #247 Update .NET SDK to 11.0.100-rc.2.
  • #224 Cap shipped Roslyn at 5.0.0 for VS 2026 18.0.
  • #208 Use Cake.Cli.BuildScriptHost for Cake.Sdk runs.

Bug

  • #282 Cake.Sdk runtime-async TargetFramework condition evaluated too early in Sdk.props.
  • #258 Generated aliases don't carry OverloadResolutionPriority, so interpolated strings bind to string log overloads in Cake.Sdk scripts.
  • #253 Generated Cake aliases fail to compile for several addins in Cake.Sdk scripts.
  • #212 Preserve indentation in generated XML documentation.
  • #210 Escape optional string and char defaults in generated aliases.
  • #207 Return CakeException.ExitCode from generated host.