Writing build scripts in C#
Automating the build and deployment tasks using Cake allows you to avoid issues and headaches associated with project deployments. A build script usually contains the steps and logic required to build and deploy the source code alongside configuration files and other artifacts of a project.
Using the sample build.cake
file available on the Cake resource repository can be a starting point for writing a build script for a project. However, to achieve more, we will walk through some basic Cake concepts that can facilitate writing robust scripts for automating build and deployment tasks.
Task
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...