May 2018
Intermediate to advanced
300 pages
7h 35m
English
When criteria is used in the Cake script, it allows you to control the flow of the execution of the build script. A criteria is a predicate that must be fulfilled for the task to execute. The criteria does not affect the execution of the succeeding task. Criteria is used to control task execution based on specified configurations, environmental states, repository branches, and any other desired options.
In the simplest form, you can use the WithCriteria method to specify the criteria of the execution of a particular task. For example, if you want to clean the debugFolder folder only in the afternoon, you can specify the criteria as in the following script:
var debugFolder = Directory("./bin/Debug");Task("CleanFolder") .WithCriteria(DateTime.Now.Hour ...