Script Aliases

Cake supports something called script aliases. Script aliases are convenience methods that are easily accessible directly from a Cake script. Every single DSL method in Cake is implemented like an alias method.

See Reference for a list of available aliases.

Calling aliases

Aliases are extension methods of ICakeContext.

Calling aliases in a Cake script

When using a Cake script with Cake .NET Tool, Cake runner for .NET Framework or Cake runner for .NET Core aliases can be called directly inside a task, without explicitly passing the context:

Task("Clean")
    .Does(() =>
{
    // Delete a file.
    DeleteFile("./file.txt");

    // Clean a directory.
    CleanDirectory("./temp");
});

Calling aliases in Frosting

Inside a Cake Frosting project aliases can be called as extension methods of the context passed to the Run method of the task:

public sealed class Clean : FrostingTask<Context>
{
    public override void Run(Context context)
    {
        // Delete a file.
        context.DeleteFile("./file.txt");

        // Clean a directory.
        context.CleanDirectory("./temp");
    }
}

Custom aliases

Additional aliases can be defined in addins.