Skip to content

Latest commit

 

History

History
195 lines (163 loc) · 7.15 KB

File metadata and controls

195 lines (163 loc) · 7.15 KB

Order: 10 Title: Cake .NET Tool RedirectFrom: docs/running-builds/runners/dotnet-core-tool

Cake .NET Tool is a runner which allows to run Cake scripts.

:::{.alert .alert-info} See Setting Up A New Cake .NET Tool Project tutorial for how to get started with Cake .NET Tool. :::

Requirements

The Cake.Tool NuGet package, is a .NET tool compiled for .NET 8 or newer.

Usage

dotnet cake [script] [switches]

^"../../../Shared/switches.txt"

Bootstrapping for .NET Tool

Bootstrapping scripts ensure you have Cake and other required dependencies installed. The bootstrapper scripts are also responsible for invoking Cake.

:::{.alert .alert-info} The following instructions require .NET 8.0 or newer. See How to manage .NET Core tools for details and other options. :::

Setup

There's a one-time setup required for configuring a repository to use Cake .NET tool.

:::{.alert .alert-info} If you have .NET Tool already available in your environment you can skip the steps in this chapter. :::

Make sure to have a tool manifest available in your repository or create one using the following command:

dotnet new tool-manifest

Install Cake as a local tool using the dotnet tool command:

dotnet tool install Cake.Tool --version <?! Meta CakeLatestReleaseName /?>

You can replace <?! Meta CakeLatestReleaseName /?> with a different version of Cake you want to use.

Getting the bootstrapper

:::{.alert .alert-info} Use of a bootstrapper is optional. You can also directly call the .NET CLI if you prefer. :::

A Bootstrapper for Cake .NET Tool 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/dotnet-tool/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/dotnet-tool/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/dotnet-tool/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

:::{.alert .alert-info} By convention this will execute the build script named build.cake. You can override this behavior by additionally passing the name of the build script. :::

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.