Calls a NAnt target in the current project.
For a list of all members of this type, see CallTask Members.
System.Object
NAnt.Core.Element
NAnt.Core.Task
NAnt.Core.Tasks.CallTask
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
When the CallTask is used to execute a target, both that target and all its dependent targets will be re-executed.
To avoid dependent targets from being executed more than once, two options are available:
<target name>
')}" to the dependent targets.
recommended
).
Call the target "build".
<call target="build" />
This shows how a project could 'compile' a debug and release build using a common compile target.
<project default="build"> <property name="debug" value="false" /> <target name="init"> <echo message="initializing" /> </target> <target name="compile" depends="init"> <echo message="compiling with debug = ${debug}" /> </target> <target name="build"> <property name="debug" value="false" /> <call target="compile" /> <property name="debug" value="true" /> <call target="compile" /> </target> </project>
The CascadeDependencies parameter of the CallTask defaults to true, causing the "init" target to be executed for both the "debug" and "release" build.
This results in the following build log:
build: init: [echo] initializing compile: [echo] compiling with debug = false init: [echo] initializing compile: [echo] compiling with debug = true BUILD SUCCEEDED
If the "init" should only be executed once, set the CascadeDependencies attribute of the CallTask to false.
The build log would then look like this:
build: init: [echo] initializing compile: [echo] compiling with debug = false compile: [echo] compiling with debug = true BUILD SUCCEEDED
Namespace: NAnt.Core.Tasks
Assembly: NAnt.Core (in NAnt.Core.dll)
CallTask Members | NAnt.Core.Tasks Namespace