if RunTarget is 'true' then all three targets are executed if RunTarget is 'false' then First is executed because Third depends on it, but Second is not executed Below are the actual results of the following script: <?xml version="1.0"?>
<project name="App" default="Third">
<property name="RunTarget" value="false"/>
<target name="First">
<echo message="First executed"/>
</target>
<target name="Second" depends="First" if="${RunTarget}" >
<echo message="Second executed"/>
</target>
<target name="Third" depends="Second" >
<echo message="Third executed"/>
</target>
</project>
RunTarget = 'true'
NAnt 0.85 (Build 0.85.1601.0; net-1.0.win32; nightly; 5/20/2004)
Copyright (C) 2001-2004 Gerry Shaw
NAnt Team
Buildfile: file:///C:/Projects/ifTest/Test.build
Target(s) specified: Third
First:
[echo] First executed
Second:
[echo] Second executed
Third:
[echo] Third executed
BUILD SUCCEEDED
Total time: 0 seconds.
RunTarget = 'false'
C:\Projects\ifTest>nant /f:Test.build
NAnt 0.85 (Build 0.85.1601.0; net-1.0.win32; nightly; 5/20/2004)
Copyright (C) 2001-2004 Gerry Shaw
NAnt Team
Buildfile: file:///C:/Projects/ifTest/Test.build
Target(s) specified: Third
First:
[echo] First executed
Third:
[echo] Third executed
BUILD SUCCEEDED
Total time: 0 seconds.
Noel
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Bob Archer
Sent: Friday, May 21, 2004 10:12 AM
To: [EMAIL PROTECTED]
Subject: [Nant-users] Target If property...
Lets say I have three targets...
<target name="First" />
<target name="Second" depends="First" if="${dothisthing}" />
<target name="Third" depends="Second" />
If dothisthing=false and Third is the default target will First then Third
run... or will First not run cause Second didn't run?
Basically as you can tell I want to skip one of my targets in a certain
circumstance?
Thanks in advance.
Bob
<<attachment: winmail.dat>>
