Cake supports something called aliases. Aliases are convenience methods that are easily accessible directly from a Cake build. 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 Cake .NET Tool
When using a Cake script with Cake .NET Tool 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 Cake 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.