<choose>

[This is preliminary documentation and subject to change.]

Executes an alternate set of task or type definition depending on conditions that are individually set on each group.

The <choose> task selects one among a number of possible alternatives. It consists of a sequence of <when> elements followed by an optional <otherwise> element.

Each <when> element has a single attribute, test, which specifies an expression. The content of the <when> and <otherwise> elements is a set of nested tasks.

The content of the first, and only the first, <when> element whose test is true is executed. If no <when> element is true, the content of the <otherwise> element is executed. If no <when> element is true, and no <otherwise> element is present, nothing is done.

Parameters

Attribute Type Description Required
failonerror bool Determines if task failure stops the build, or is just reported. The default is true. False
if bool If true then the task will be executed; otherwise, skipped. The default is true. False
unless bool Opposite of if. If false then the task will be executed; otherwise, skipped. The default is false. False
verbose bool Determines whether the task should report detailed build log messages. The default is false. False

Nested Elements:

<when>

One or more alternative sets of tasks to execute.

Groups a set of tasks to execute when a condition is met.

Parameters

AttributeTypeDescriptionRequired
testbool Used to test arbitrary boolean expression. True

</when>

<otherwise>

The set of tasks to execute if none of the When elements are true.

Executes embedded tasks in the order in which they are defined.

</otherwise>

Examples

Requirements

Assembly: NAnt.Contrib.Tasks (0.92.4495.0)