<if>Checks the conditional attributes and executes the children if true.
If no conditions are checked, all child tasks are executed. True is the default condition result. If more than one attribute is used, they are And'd together. The first to fail stops the check. Attribute | Description | Required |
---|
uptodateFile | The file to compare if uptodate. | False | compareFile | The file to check against for the uptodate file. | False | propertytrue | Used to test whether a property is true. | False | propertyexists | Used to test whether a property exists. | False | targetexists | Used to test whether a target exists. | False | failonerror | Determines whether task failure stops the build or is just reported. Default is "true." | False | verbose | Task reports detailed build log messages. Default is "false." | False | if | If true then the task will be executed; otherwise skipped. Default is "true." | False | unless | Opposite of if. If false then the task will be executed; otherwise skipped. Default is "false." | False |
Check existence of a property
Example
<if propertyexists="myProp">
<echo message="myProp Exists. Value='${myProp}'"/>
</if>
Check that a property value is true
Example
<if propertytrue="myProp">
<echo message="myProp is true. Value='${myProp}'"/>
</if>
Check that a target exists
Example
<target name="myTarget"/>
<if targetexists="myTarget">
<echo message="myTarget exists."/>
</if>
Checks file dates
Example
<if uptodatefile="myfile.dll" comparefile="myfile.cs">
<echo message="myfile.dll is newer/same-date as myfile.cs"/>
</if>
|