| NAnt  Help  Task Reference  <choose> | v0.92-rc1 | 
[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. 
| 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 | 
Groups a set of tasks to execute when a condition is met.
| Attribute | Type | Description | Required | 
|---|---|---|---|
| test | bool | Used to test arbitrary boolean expression. | True | 
Executes embedded tasks/elements in the order in which they are defined.
Execute alternate set of tasks depending on the configuration being built.
<choose>
    <when test="${build.config == 'Debug'}">
        <!-- compile app in debug configuration -->
        ...
    </when>
    <when test="${build.config == 'Release'}">
        <!-- compile app in release configuration -->
        ...
    </when>
    <otherwise>
        <fail>Build configuration '${build.config}' is not supported!</fail>
    </otherwise>
</choose>
    
       Define a sources patternset holding an alternate set of patterns depending on the configuration being built. 
<choose>
    <when test="${build.config == 'Debug'}">
        <patternset id="sources">
            <include name="**/*.cs" />
        </patternset>
    </when>
    <when test="${build.config == 'Release'}">
        <patternset id="sources">
            <include name="**/*.cs" />
            <exclude name="**/Instrumentation/*.cs" />
        </patternset>
    </when>
    <otherwise>
        <fail>Build configuration '${build.config}' is not supported!</fail>
    </otherwise>
</choose>