The Cake runner for .NET Framework is deprecated and no longer updated since Cake 2.0. It is suggested to use Cake .NET Tool for running Cake scripts.
Requirements
The Cake NuGet package was a runner requiring .NET Framework 4.6.1
or newer on Windows and Mono 5.12.0
or newer on Mac or Linux.
It is suggested to use .NET Framework 4.7.2 or newer to run build scripts which are using addins targeting .NET Standard 2.0 only.
Usage
Cake.exe [script] [switches]
Switches
Switch | Description | Available Since |
---|---|---|
--bootstrap | Download/install modules defined by #module directives, but do not run build. Since 1.0.0-rc0001 bootstrapping is done by default when running build. |
0.24.0 |
-d, --debug | Launches script in debug mode. | 0.12.0 |
--description | Shows description about tasks. | 0.1.10 |
--dryrun | Performs a dry run. | 0.2.0 |
-e, --exclusive | Execute a single task without any dependencies. | 0.29.0 |
-h, --help | Prints help information. | 0.1.12 |
--info | Displays additional information about Cake execution. | 0.31.0 |
--skip-bootstrap | Skips bootstrapping when running build. | 1.0.0-rc0001 |
--tree | Shows the task dependency tree. | 0.31.0 |
-v, --verbosity <VERBOSITY> | Specifies the amount of information to be displayed (quiet, minimal, normal, verbose, diagnostic). | 0.1.1 |
--version | Displays version 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.
Use a space instead of =
if the value of a switch can be empty or null:
--foo ""
Bootstrapping for Cake runner for .NET Framework
Bootstrapping scripts ensure you have Cake and other required dependencies installed. The bootstrapper scripts are also responsible for invoking Cake.
Getting the bootstrapper
Bootstrapper for Cake runner for .NET Framework is available in the Cake Resources repository and can be installed using the command for your operating system from below:
Open a new PowerShell window and run the following command:
Invoke-WebRequest https://cakebuild.net/download/bootstrapper/windows -OutFile build.ps1
Sometimes PowerShell might prevent you from running build.ps1
.
Make sure to have RemoteSigned
policy enabled.
See About Execution Policies for details.
If you have RemoteSigned
policy enabled and still an error occurrs it might be because
the file was downloaded from the internet and is blocked.
The following command will unblock the file:
Unblock-File path\to\build.ps1
See Unblock-File for details.
Open a new shell and run the following command:
curl -Lsfo build.sh https://cakebuild.net/download/bootstrapper/linux
If you are downloading the build.sh
file on a Windows machine you can give the script permission to execute using the following command:
git update-index --add --chmod=+x build.sh
This assumes that you have the Git command line installed.
Open a new shell and run the following command:
curl -Lsfo build.sh https://cakebuild.net/download/bootstrapper/osx
If you are downloading the build.sh
file on a Windows machine you can give the script permission to execute using the following command:
git update-index --add --chmod=+x build.sh
This assumes that you have the Git command line installed.
Running build script
To launch Cake run the bootstrapper:
Open a new PowerShell window and run the following command:
./build.ps1
Open a new shell and run the following command:
build.sh
Open a new shell and run the following command:
build.sh
Extending the bootstrapper
The bootstrapper that you can get directly from cakebuild.net is intended as a starting point for what can be done. It is the developer's discretion to extend the bootstrapper to solve for your own requirements.
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.
These instructions assume you are using the NuGet CLI as done in the default bootstrapper for Windows or default bootstrapper for macOS & Linux.
Update the bootstrapper
Replace the following line in the bootstrapper:
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
with:
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`" -Source https://pkgs.dev.azure.com/cake-build/Cake/_packaging/cake/nuget/v3/index.json"
Replace the following line in the bootstrapper:
mono "$NUGET_EXE" install -ExcludeVersion
with:
mono "$NUGET_EXE" install -ExcludeVersion -Source https://pkgs.dev.azure.com/cake-build/Cake/_packaging/cake/nuget/v3/index.json"
Replace the following line in the bootstrapper:
mono "$NUGET_EXE" install -ExcludeVersion
with:
mono "$NUGET_EXE" install -ExcludeVersion -Source https://pkgs.dev.azure.com/cake-build/Cake/_packaging/cake/nuget/v3/index.json"
Modify the
packages.config
file to pin the Cake version to one of the pre-releases:<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Cake" version="1.0.0-alpha0079" /> </packages>