none
CallCompile target

    Question

  •  

    in TFS 2008, in the Microsoft.TeamFoundation.Build.targets file, the CallCompile target uses a MSBuild task to invoke the CoreCompile target.

     

    Is there a reason why CoreCompile is invoked in this roundabout way in TFS 2008? Could it not be invoked directly like other targets .. ? Why is the MSBuild task used to invoke CoreCompile .. ?

     

    Looks like a similar technique is used in CallClean target. Inside CallClean, MSBuild task is invoked to call CoreCleanCompilationOutput target. Could CoreCleanCompilationOutput target not be called directly ?

     

    Thanks in advance.

    Tuesday, February 26, 2008 12:57 AM

Answers

  • This is due to a quirk/feature in MSBuild...  CoreCompile (and CoreClean and CoreTest) has a target named ComputeConfigurationList in its dependency chain - this target essentially builds up the list of recursive calls to TfsBuild.proj that will be made for the platform/configuration combinations specified in the ConfigurationToBuild item group.  For a variety of reasons, we want this target to get executed multiple times - once during the Clean targets, once during the Compile targets, and once during the Test targets - rather than just a single time.  Typically MSBuild does not like to execute targets more than once during the course of a build - the only way to force this is to call the target with different global properties.  Adding the level of indirection between the CallX and the CoreX targets allows us to pass a bunch of global properties into the CoreX targets, meaning that their dependent ComputeConfigurationList targets will get executed if any of these have changed.

     

    -Aaron

    Tuesday, February 26, 2008 7:56 PM