Testing pre-releases

Pre-releases of Cake are published to the Cake feed ahead of each major or minor release. Trying them out and reporting what you find is one of the most helpful ways to contribute.

The examples below use placeholders such as <version>. Find the current pre-release versions by browsing the Cake feed or the Cake repository releases.

Package Latest Released Latest Pre-release (Cake feed)
Cake.Tool NuGet Azure Artifacts
Cake.Frosting NuGet Azure Artifacts
Cake.Core NuGet Azure Artifacts
Cake.Common NuGet Azure Artifacts
Cake.Sdk NuGet Azure Artifacts
Cake.Generator NuGet Azure Artifacts
Cake.Template NuGet Azure Artifacts

Different package groups are versioned independently. Cake.Tool, Cake.Frosting, Cake.Core and Cake.Common share one version, while Cake.Sdk, Cake.Generator and Cake.Template share another.

1. Prerequisites

  • The .NET SDK required by the pre-release. Check the release notes for the target frameworks and whether a preview/RC SDK is needed. Install additional SDKs if you want to test more than one target framework.
  • A nuget.config in your repository root (next to cake.cs/build.cake/your .csproj) or in a parent folder:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="cake" value="https://pkgs.dev.azure.com/cake-build/Cake/_packaging/cake/nuget/v3/index.json" />
  </packageSources>
  <packageSourceMapping>
    <packageSource key="cake">
      <package pattern="Cake.Cli" />
      <package pattern="Cake.Common" />
      <package pattern="Cake.Core" />
      <package pattern="Cake.DotNetTool.Module" />
      <package pattern="Cake.Frosting" />
      <package pattern="Cake.Generator" />
      <package pattern="Cake.NuGet" />
      <package pattern="Cake.Sdk" />
      <package pattern="Cake.Template" />
      <package pattern="Cake.Tool" />
    </packageSource>
    <packageSource key="nuget">
      <package pattern="*" />
    </packageSource>
  </packageSourceMapping>
</configuration>

If your repository already has a nuget.config with source mapping, merge the cake source and its patterns into it.

2. Point your build at the pre-release

Start from a template

Run these in a folder that has the nuget.config above:

dotnet new install Cake.Template::<sdk-version>
Template Creates
cakefile File-based cake.cs (add --IncludeExampleProject true for a sample solution in src/)
cakeminimalfile Trivial file-based cake.cs
cakemultifile File-based script split over several files
cakeproj Project-based build/build.csproj using Cake.Sdk (--Framework selects the target framework)
cakeglobaljson global.json pinning the .NET SDK and Cake.Sdk, and enabling Microsoft.Testing.Platform for dotnet test
cakeci CI pipeline for running a Cake file-based build script

File-based:

dotnet new cakefile -n cake --IncludeExampleProject true
dotnet new cakeglobaljson
dotnet run cake.cs

Project-based:

dotnet new cakeproj -n build
dotnet new cakeglobaljson
dotnet run --project build

The example project's tests use Microsoft.Testing.Platform, so add cakeglobaljson or dotnet test will fail. cakeglobaljson pins an exact .NET SDK version; if you use a different SDK build, edit the generated global.json or pass --SdkVersion.

Generate a CI pipeline with cakeci by selecting a provider:

dotnet new cakeci --Provider github

The template supports several CI providers. See the Cake SDK CI Pipeline template documentation for the provider list and options such as selecting a build script or runner OS.

Existing Cake.Tool build (build.cake)

dotnet tool update Cake.Tool --version <tool-version>
dotnet cake

Add -g for a global tool.

Existing Cake.Sdk build (file-based cake.cs)

#:sdk Cake.Sdk@<sdk-version>
dotnet run cake.cs

Run it from a file, piping code through stdin doesn't pick up nuget.config.

Cake.Frosting

<PackageReference Include="Cake.Frosting" Version="<version>" />

Addin and module authors

<PackageReference Include="Cake.Core" Version="<version>" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="<version>" PrivateAssets="All" />

With central package management, set these versions on PackageVersion instead.

3. Report what you find

Start a question in the cake-build Q&A discussions. These organization-level discussions are a place to share feedback about both Cake and Generator. Include the package versions, operating system and target framework.