Continuing the Hidden Features series for Nant.
One of the things I learned recently was
<xmlpoke>
Allows you to replace text in an xml file.
Question will be updated to show the top voted answers
Continuing the Hidden Features series for Nant.
One of the things I learned recently was
<xmlpoke>
Allows you to replace text in an xml file.
Question will be updated to show the top voted answers
Sometimes you want a particular target to run multiple times - say, if its behavior is configurable by setting properties.
<call>
Allows you to directly invoke a target and it's dependencies.
See Also
You can parameterise your NAnt scripts.
To pass a value on the commandline, use -D
:
nant -D:database.server=localhost rebuild.database
Then, in your script, create a subtarget that verifies the configuration and gives help if necessary:
<target name="require.database.server">
<fail message="Define database server using -D:database=<host>"
unless="${property::exists('database.server')}"/>
</target>
You can even use a default value:
<property name="database.server"
value="${environment::get-machine-name()}"
overwrite="false"
unless="${property::exists('database.server')}"/>