Reputation: 3773
I am using a two TARGET files. On one TARGET file I call a TARGET that is inside the second TARGET file. This second TARGET then calls another TARGET that has 6 other TARGET calls, which do a number of different things (in addition to calling other nested TARGETS (but inside the same TARGET file)). The problem is that, on the TARGET where I call 6 TARGETS, only the first one is being executed. The program doesnt find its way to call the 2nd, 3rd, 4th, 5th, and 6th TARGET. Is there a limit to the number of nested TARGETS that can be called and run? Nothing is failing. The problem is the other TARGET calls are not running. Thanks for any help you can provide.
Upvotes: 4
Views: 2515
Reputation: 49970
There is no limit to the number of targets nested. Have you tried running msbuild with all the log to see why the targets are not called :
msbuild [project.file] /verbosity:detailed
I think this is due to unfulfilled condition (Condition
attribute on target), unchanged input (Input
attribute on target) or you are trying to call the same target multiples times.
Using MSBuild
task :
<!-- The target we want to execute multiple times -->
<Target Name="VeryUsefulOne">
<Message Text="Call VeryUsefulOne Target"/>
</Target>
<Target Name="One">
<Message Text="One"/>
<MSBuild Targets="VeryUsefulOne"
Properties="stage=one"
Projects="$(MSBuildProjectFile)"/>
</Target>
<Target Name="Two">
<Message Text="Two"/>
<MSBuild Targets="VeryUsefulOne"
Properties="stage=two"
Projects="$(MSBuildProjectFile)"/>
</Target>
<Target Name="OneTwo">
<CallTarget Targets="One;Two"/>
</Target>
It's important to change Properties
value between call.
Upvotes: 5