At the core of the build automation with Cake is the task. A task in Cake is a simple unit of work that is used to carry out a specific action or activity in a desired defined order. Tasks in Cake can have specified criteria, associated dependencies, and error handling.
A task can be defined by using the Task method, with the task name or caption passed into it as an argument:
Task("Action") .Does(() =>{ // Task code goes here});
For example, the build task in the following snippet cleans the debugFolder folder to delete the contents. When the task is run, the CleanDirectory method will be invoked:
var debugFolder = Directory("./bin/Debug");Task("CleanFolder") .Does(() =>{ CleanDirectory(debugFolder);});
Cake allows you to use C# to ...