As software complexity increases, proper build practices become ever more important. This essential reference drills inside MSBuild—and shows how to maximize your control over the build and deployment process. Learn how to customize and extend build processes with MSBuild—and scale them to the team, product, or enterprise level with Team Foundation Build.
Discover how to:
Create and modify MSBuild files—outside the Visual Studio IDE
Use XML-based syntax to declare dynamic properties and items
Apply built-in tasks or write your own
Customize the build process—adding code generation, unit testing, or code analysis
Use batching and incremental builds to reduce build times
Invoke external tools in scripts and create reusable files
Start and stop services
Set assembly versions and extend the clean process
Configure, customize, and extend Team Build—and automate build from end to end
Overview
Chapter 1 MSBuild Quick Start
Project File Details
Properties and Targets
Items
Item Metadata
Simple Conditions
Default/Initial Targets
MSBuild.exe Command Line Usage
Extending the Build Process
Chapter 2 MSBuild Deep Dive, Part 1
Properties
Environment Variables
Items
Copy Task
Chapter 3 MSBuild Deep Dive, Part 2
Dynamic Properties and Items
Property and Item Evaluation
Importing Files
Extending the Build Process
Customizing MSBuild
Chapter 4 Custom Tasks
Custom Task Requirements
Creating Your First Task
Task Input/Output
Supported Task Input and Output Types
Using Arrays with Task Inputs and Outputs
Extending ToolTask
Debugging Tasks
Chapter 5 Custom Loggers
Overview
Console Logger
File Logger
ILogger Interface
Creating Custom Loggers
Extending the Logger Abstract Class
Extending Existing Loggers
FileLoggerBase and XmlLogger
Debugging Loggers
Advanced MSBuild Topics
Chapter 6 Batching and Incremental Builds
Batching Overview
Task Batching
Target Batching
Combining Task and Target Batching
Multi-batching
Using Batching to Build Multiple Configurations
Batching Using Multiple Expressions
Batching Using Shared Metadata
Incremental Building
Chapter 7 External Tools
Exec Task
MSBuild Task
MSBuild and Visual Studio Known Error Message Formats
Creating Reusable Build Elements
NUnit
FxCop
MSBuild Cookbook
Chapter 8 Practical Applications, Part 1
Setting the Assembly Version
Building Multiple Projects
Attaching Multiple File Loggers
Custom Before/After Build Steps in the Build Lab
Handling Errors
Replacing Values in Config Files
Extending the Clean
Chapter 9 Practical Applications, Part 2
Starting and Stopping Services
Web Deployment Project Overview
Zipping Output Files, Then Uploading to an Ftp Site
Compressing JavaScript Files
Encrypting web.config
Building Dependent Projects
Extending the Clean Process
Deployment Using Web Deployment Projects
Team Foundation Build
Chapter 10 Team Build Quick Start
Introduction to Team Build
Preparing for Team Build
Creating a Build Definition
Working with Build Queues and History
Team Build Security
Chapter 11 Team Build Deep Dive
Default Build Processes
Customizing the Build Process
Configuring the Team Build Service
Team Build API
Upgrading from Team Build 2005
Chapter 12 Team Build Cookbook
Documentation
Infrastructure
Logging
Packaging and Deployment
Versioning
Appendix A New Features in MSBuild 3.5
Properties and Items Declared Inside Targets
Multiprocessor Support
Multitargeting
ItemDefinitionGroup
Registry Syntax
New Reserved Properties
MSBuild Task Changes
Exec Task Changes
Appendix B Common Properties and Items
Common Properties
Common Items
Appendix C New Features in Visual Studio Team System 2010 Team Build
Windows Workflow Foundation
Build Templates
Build Controllers
Gated Check-in
Private Builds
Improved Control over Build Deletion
Integration with Symbol and Source Server, WiX, Visual Studio Team System for Database Professionals, and MSTest
Usability Improvements to Build Details
Where Does This Leave MSBuild?
Appendix About the Authors
Sayed Ibrahim Hashimi
William Bartholomew
Title:
Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build
Sayed Ibrahim Hashimi is a consultant, trainer, and senior software developer who has designed large-scale, distributed applications using a variety of programming languages and platforms, including Microsoft .NET, C++, and Java. This is his third book on MSBuild.
William Bartholomew is a software development engineer at Microsoft Corporation in Redmond, WA. He is a member of the Developer Division Engineering Systems group, which includes the build lab responsible for building and shipping Microsoft Visual Studio®.