tags:

views:

31

answers:

1

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.

Oscar Bautista

A: 

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.

Invoke the same target multiple 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.

madgnome
I need to call the same target 6 times. I dont think I can call the same target more than once. I may need to batch this, but not sure how. IE:<Target Name="Main"> <Message Text="test"></Target><Target Name="one"> <CallTarget Targets="Main"></Target><Target Name="two"> <CallTarget Targets="Main"></Target><Target Name="three"> <CallTarget Targets="Main"></Target><Target Name="four"> <CallTarget Targets="Main"></Target><Target Name="five"> <CallTarget Targets="Main"></Target><Target Name="siz"> <CallTarget Targets="Main"></Target>
obautista