The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CallTarget Task

Invokes the specified targets within the project file.

The following table describes the parameters of the CallTarget task.

Parameter Description


Optional Boolean output parameter.

If true, the MSBuild engine is called once per target. If false, the MSBuild engine is called once to build all targets.


Optional ITaskItem[] output parameter.

Contains the outputs of all built targets.


Optional String[] parameter.

Specifies the target or targets to build.

If a target specified in Targets fails and RunEachTargetSeparately is true, the task continues to build the remaining targets.

If you want to build the default targets, use the MSBuild Task and set the Projects parameter equal to $(MSBuildProjectFile).

The following example calls TargetA from inside CallOtherTargets.

<Project DefaultTargets="CallOtherTargets"

    <Target Name="CallOtherTargets">
        <CallTarget Targets="TargetA"/>

    <Target Name="TargetA">
        <Message Text="Building TargetA..." />

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft