There's a document in the Visual Studio 2005 SDK that describes the extensibility points in Team Build.  I have the April release of the SDK, so it's located at C:\Program Files\Visual Studio 2005 SDK\2006.04\VisualStudioTeamSystemIntegration\Team Build\Team Build Extensibility.doc.

The SDK is a huge download, so I'm attaching the document to this blog post.

Here's what's covered in the document.

  • Understanding Team Foundation Build configuration files
    • Order in which targets are executed by Team Foundation Build
  • Extending Team Foundation Build
    • Creating a Build Type
    • Creating Custom Tasks
    • Checking Out the TfsBuild.proj File
    • Registering Your Task
    • Calling Your Task
    • Checking In the TfsBuild.proj and Task .dll Files
  • Example Task
    • C# Task Code Example
    • Sample TfsBuild.proj File

One useful piece of information is the order in which the targets are executed.  I've copied that section below, and the ones marked with an asterisk are specifically designed to be overridden for adding custom behavior (overriding the Core* targets may result in you needing to fix your project files when future versions are released).

1. BeforeEndToEndIteration*
2. BuildNumberOverrideTarget*
3. InitializeEndToEndIteration
4. BeforeClean*
5. CoreClean
6. AfterClean*
7. Clean
8. InitializeBuild
9. BeforeGet*
10. InitializeWorkspace
11. CoreGet
12. AfterGet*
13. PreBuild
14. BeforeCompile*
15. CoreCompile
16. AfterCompile*
17. Compile
18. GetChangeSetsAndUpdateWorkItems
19. PostBuild
20. BeforeTest*
21. CoreTest
22. AfterTest*
23. Test
24. PackageBinaries*
25. TeamBuild
26. BeforeDropBuild*
27. CoreDropBuild
28. CopyLogFiles
29. AfterDropBuild*
30. DropBuild
31. AfterEndToEndIteration*
32. EndToEndIteration

The targets marked by an “*” are those defined for extensibility and you should plug in your tasks using one of these depending on your need. It is not recommended to modify other targets because Team Foundation Build calls its own pre-defined tasks in those other targets.

[Update]  I just noticed that Eric Charran has a similar post from earlier this week.  He points to the MSDN docs that provide a short explanation for each: http://msdn2.microsoft.com/en-us/library/aa337604.aspx.