<foreach>

Loops over a set of items.

Can loop over files in directory, lines in a file, etc.

The property value is stored before the loop is done, and restored when the loop is finished.

The property is returned to its normal value once it is used. Read-only parameters cannot be overridden in this loop.

Parameters

Attribute Type Description Required
item LoopItem The type of iteration that should be done. True
property string The NAnt property name(s) that should be used for the current iterated item. True
delim string The deliminator char. False
in string The source of the iteration. False
trim LoopTrim The type of whitespace trimming that should be done. The default is None. False
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:

<in>

Stuff to operate in. Just like the in attribute, but supports more complicated things like a <fileset> and such.

Note: Please remove the in attribute if you are using this element.

Nested Elements:

<items>

</items>

</in>

<do>

Tasks to execute for each matching item.

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

Parameters

AttributeTypeDescriptionRequired
failonerrorbool Determines if task failure stops the build, or is just reported. The default is true. False
ifbool If true then the task will be executed; otherwise, skipped. The default is true. False
unlessbool Opposite of if. If false then the task will be executed; otherwise, skipped. The default is false. False
verbosebool Determines whether the task should report detailed build log messages. The default is false. False

</do>

Examples

Requirements

Assembly: NAnt.Core (0.92.4543.0)