Team_Build_Target_Map1.docx (22.73 KB)

I had the good fortune of reviewing the upcoming book titled Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build. This book is an absolute must for anyone who is creating and customizing build definitions in Team Foundation Build. As part of my review process I created a map that lists the order of target invocation. I found this map very handy, so I’m posting it because I figure others will find it handy too. The map is listed below, and also contained in the attached word document. If you make any corrections or improvements to the map, please share back!

By the way, MSBuild Sidekick turned out to be very useful in building this map. The Team Foundation Build targets file is large and complex. MSBuild Sidekick’s tree-view makes it much easier to navigate this beast, and the search features made it easy to traverse the target dependencies. This is a very handy tool for editing (or studying) build scripts.

This map shows the order of target execution in the Team Build targets file,  %ProgramFiles%MSBuildMicrosoftVisualStudioTeamBuildMicrosoft.TeamFoundation.Build.targets. The target names in the map are color coded as follows:

Green: this is an extensibility target that can be customized in your TFSBuild.proj file
Blue: This is run as a separate MSBuild process to support parallel processing

EndToEndIteration

When a Team Build agent starts a new build, the build starts by invoking the EndToEndIteration target. This target then invokes the following chain of targets.

·         CheckSettingsForEndToEndIteration

·         InitializeBuildProperties

·         BeforeEndToEndIteration

·         BuildNumberOverrideTarget

·         InitializeEndToEndIteration

·         InitializeWorkspace

o   BeforeInitializeWorkspace

o   CoreInitializeWorkspace

o   AfterInitializeWorkspace

·         TeamBuild

o   CleanAll (CleanCompilationOutputOnly != true)

o   InitializeBuild

o   PreBuild

§  Get

·         BeforeGet

·         CoreGet (SkipGet != true)

·         AfterGet

§  Label

·         BeforeLabel

·         CoreLabel (SkipLabel != true)

·         AfterLabel

o   CleanCompilationOutput (CleanCompilationOutputOnly == true)

§  BeforeClean

§   CallClean (SkipClean != true)

·         CoreCleanCompilationOutput

o   ComputeConfigurationList

o   CleanConfiguration

§  BeforeCleanConfiguration

§  CoreCleanConfiguration

·         ComputeSolutionList

·         CleanSolution

§  AfterCleanConfiguration

§   AfterClean

o   Compile

§  BeforeCompile

§  CallCompile

·         CoreCompile

o   CompileConfiguration

§  BeforeCompileConfiguration

§   CoreCompileConfiguration

·         ComputeSolutionList

·         CompileSolution

o   BeforeCompileSolution

o    CoreCompileSolution

o    AfterCompileSolution

§   AfterCompileConfiguration

§   AfterCompile

o   PostBuild (SkipPostBuild != true)

§  GetChangesetsAndUpdateWorkItems

·         BeforeGetChangesetsAndUpdateWorkItems

·          CoreGetChangesetsAndUpdateWorkItems (SkipGetChangesetsAndUpdateWorkItems != true)

·          AfterGetChangesetsAndUpdateWorkItems

o   Test

§  BeforeTest

§   CoreTest

·         RunTest

o   TestConfiguration

§  BeforeTestConfiguration

§   CoreTestConfiguration

·         ResolveTestFilesForEndToEndIteration

§   AfterTestConfiguration

§   AfterTest

o   GenerateDocumentation

o   PackageBinaries

·         DropBuild

o   BeforeDropBuild

o    CoreDropBuild (SkipDropBuild != true)

o    AfterDropBuild

·         AfterEndToEndIteration

DesktopBuild

This is the target execution sequence when you perform a Desktop Build. For more information on configuring and using a Destop Build, see this MSDN article.

·         Compile

o   BeforeCompile

o   CallCompile

§  CoreCompile

·         CompileConfiguration

o   BeforeCompileConfiguration

o    CoreCompileConfiguration

§  ComputeSolutionList

§  CompileSolution

·         BeforeCompileSolution

·          CoreCompileSolution

·          AfterCompileSolution

o    AfterCompileConfiguration

o    AfterCompile

·          Test

o   BeforeTest

o    CoreTest

§  RunTest

·         TestConfiguration

o   BeforeTestConfiguration

o    CoreTestConfiguration

o   AfterTestConfiguration

o    AfterTest

·          GenerateDocumentation

·          PackageBinaries

DesktopRebuild

Start a build using DesktopRebuild as the initial target to perform a clean, full compilation and run tests.  For more information on how to build team projects on the desktop, see this MSDN article.

·         Clean

o   BeforeClean

o   CoreClean

·         CoreCleanAll (CleanCompilationOutput != true AND SkipClean != true)

·         CallClean (CleanCompilationOutput == true AND SkipClean != true)

o   CoreCleanCompilationOutput

§  ComputeConfigurationList

§  CleanConfiguration

·         BeforeCleanConfiguration

·         CoreCleanConfiguration

o   ComputeSolutionList

o   CleanSolution

·         AfterCleanConfiguration

o   AfterClean

·         DesktopRebuild (see previous section for details)

OnBuildBreak

If an error occurs during the compile phase, normal processing is suspended and the OnBuildBreak target is invoked. This target then invokes the following sequence of targets:

·         BeforeOnBuildBreak

·          CoreOnBuildBreak

o   GetChangesetsOnBuildBreak

§  BeforeGetChangesetsOnBuildBreak

§   CoreGetChangesetsOnBuildBreak (SkipGetChangesetsAndUpdateWorkItems != true)

§   AfterGetChangesetsOnBuildBreak

o   DropBuild

§  BeforeDropBuild

§   CoreDropBuild

§   AfterDropBuild

o   CreateWorkItem

§  BeforeCreateWorkItem

§  CoreCreateWorkItem (SkipWorkItemCreation != true)

§  AfterCreateWorkItem

·         AfterOnBuildBreak

Skip Properties

These properties are used to suppress the execution of certain targets in the build sequence.  A complete list of customizable Team Foundation Build properties can be found in this MSDN article.

·         SkipClean

·         SkipDropBuild

·         SkipGet

·         SkipGetChangesetsAndUpdateWorkItems

·         SkipInitializeWorkspace

·         SkipInvalidConfigurations

·         SkipLabel

·         SkipPostBuild

·         SkipWorkItemCreation