当前位置: 动力学知识库 > 问答 > 编程问答 >

xml - MSBuild. Execution of second target

问题描述:

I use code like this:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<UsingTask TaskName="MSBuildTasks.Tasks.XmlReader" AssemblyFile="Tasks/MSBuildTasks.dll"/>

<Target Name="Start">

<CallTarget Targets="test1"/>

<CallTarget Targets="test2"/>

</Target>

<Target Name="test1">

<Message Text="text1"/>

</Target>

<Target Name="test2" DependsOnTargets="test1;"> //I tried with and without semicolon

<Message Text="text2"/>

</Target>

</Project>

My output works fine. But if I delete "Start" target. Output shows the message only form first target.

If it is not supposed to work in that way what for the DependsOnTargets attribute?

What is "True" way to execute multiple targets?

MsBuild 4.0, VS 2010 CMD.

网友答案:

How do you call the script, i.e. the /targets: option?

I'm guessing since you don't specify DefaultTargets or InitialTargets MSBuild by default executes the first target available and since it's no longer Start but test1 the DependsOnTargets is no longer relevant.

分享给朋友:
您可能感兴趣的文章:
随机阅读: