Since version 2.0 Microsoft has integrated MSBuild, a build system, into the .NET Framework that is fully compatible with Visual Studio projects. Bart de Smet shows how to extend MSBuild via custom tasks.
Although the set of built-in MSBuild tasks covers most of a developer's needs, some areas - especially deployment, integration of version control systems, configuration of servers and IIS web sites as well as ActiveDirectory tasks are left out. The MSBuild Community Tasks Project and the SDC Tasks Library, which are both freely available, provide many MSBuild tasks that address most of the issues in these areas. If something's still missing, you have to (and can) help yourself.
Bart de Smet shows how to create and debug custom MSBuild tasks. Whereas his first article serves as an introduction to creating custom tasks, his second article is written in a cookbook-style and focuses on debugging. According to Bart the development of a custom task is divided into 8 steps:
Step 1 - Create a Class Library project
Step 2 - Import references
Step 3 - Implement the task skeleton
Step 4 - Task parameterization
Step 5 - Implementing functionality
Step 6 - Setting up debugging
Step 7 - Set a breakpoint and run
Step 8 - Advanced debugging
Debugging is essentially configured in the custom MSBuild task's project properties: The project's start action must be set to the MSBuild executable (which should match the MSBuild assemblies referenced by the project) and the start options have to include the path to a test MSBuild project file.
The MSBuild Team blog provides further information and help, and the article "MSBuild - What It Does and What You Can Expect in the Future" by Dan Moseley and Xin Yan is a good summary of MSBuild's features, concepts, new file format features in .NET 3.5, and future directions.