You are previewing Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build, Second Edition.
O'Reilly logo
Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build, Second Edition

Book Description

As software complexity increases, proper build practices become ever more important. This essential reference—fully updated for Visual Studio 2010—drills inside MSBuild and shows you 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.

Table of Contents

  1. Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build, Second Edition
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Praise for: Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build, Second Edition
  5. Foreword
  6. Introduction
    1. Who This Book Is For
      1. Assumptions
    2. Organization of This Book
    3. System Requirements
    4. Code Samples
    5. Acknowledgements
      1. Sayed Ibrahim Hashimi
      2. William Bartholomew
      3. Pavan Adharapurapu
      4. Jason Ward
    6. Errata and Book Support
    7. We Want to Hear from You
    8. Stay in Touch
  7. I. Overview
    1. 1. MSBuild Quick Start
      1. Project File Details
      2. Properties and Targets
      3. Items
      4. Item Metadata
      5. Simple Conditions
      6. Default/Initial Targets
      7. MSBuild.exe Command-Line Usage
      8. Extending the Build Process
    2. 2. MSBuild Deep Dive, Part 1
      1. Properties
      2. Environment Variables
        1. Reserved Properties
        2. Command-Line Properties
        3. Dynamic Properties
      3. Items
      4. Copy Task
        1. Well-Known Item Metadata
        2. Custom Metadata
        3. Item Transformations
          1. Demo01
          2. Demo02
          3. Demo03
          4. Demo04
    3. 3. MSBuild Deep Dive, Part 2
      1. Dynamic Properties and Items
        1. Dynamic Properties and Items: MSBuild 3.5
          1. Removing Items
      2. Property and Item Evaluation
      3. Importing Files
      4. Extending the Build Process
      5. Property Functions and Item Functions
        1. Property Functions
        2. String Property Functions
        3. Static Property Functions
        4. MSBuild Property Functions
        5. Item Functions
  8. II. Customizing MSBuild
    1. 4. Custom Tasks
      1. Custom Task Requirements
      2. Creating Your First Task
      3. Task Input/Output
      4. Supported Task Input and Output Types
      5. Using Arrays with Task Inputs and Outputs
      6. Inline Tasks
      7. TaskFactory
      8. Extending ToolTask
        1. ToolTask Methods
        2. ToolTask Properties
      9. Debugging Tasks
    2. 5. Custom Loggers
      1. Overview
      2. Console Logger
      3. File Logger
      4. ILogger Interface
      5. Creating Custom Loggers
      6. Extending the Logger Abstract Class
      7. Extending Existing Loggers
      8. FileLoggerBase and XmlLogger
      9. Debugging Loggers
  9. III. Advanced MSBuild Topics
    1. 6. Batching and Incremental Builds
      1. Batching Overview
      2. Task Batching
      3. Target Batching
      4. Combining Task and Target Batching
      5. Multi-batching
      6. Using Batching to Build Multiple Configurations
      7. Batching Using Multiple Expressions
      8. Batching Using Shared Metadata
      9. Incremental Building
        1. Partially Building Targets
    2. 7. External Tools
      1. Exec Task
      2. MSBuild Task
      3. MSBuild and Visual Studio Known Error Message Formats
      4. Creating Reusable Build Elements
      5. NUnit
      6. FxCop
  10. IV. MSBuild Cookbook
    1. 8. Practical Applications, Part 1
      1. Setting the Assembly Version
      2. Building Multiple Projects
      3. Attaching Multiple File Loggers
        1. Creating a Logger Macro
      4. Custom Before/After Build Steps in the Build Lab
      5. Handling Errors
      6. Replacing Values in Config Files
      7. Extending the Clean
    2. 9. Practical Applications, Part 2
      1. Starting and Stopping Services
      2. Web Deployment Project Overview
      3. Zipping Output Files, Then Uploading to an FTP Site
      4. Compressing JavaScript Files
      5. Encrypting web.config
      6. Building Dependent Projects
      7. Deployment Using Web Deployment Projects
  11. V. MSBuild in Visual C++ 2010
    1. 10. MSBuild in Visual C++ 2010, Part 1
      1. The New .vcxproj Project File
      2. Anatomy of the Visual C++ Build Process
      3. Diagnostic Output
      4. Build Parallelism
        1. Configuring Project- and File-Level Build Parallelism
      5. File Tracker–Based Incremental Build
        1. Incremental Build
        2. File Tracker
        3. Trust Visual C++ Incremental Build
        4. Troubleshooting
      6. Property Sheets
        1. System Property Sheets and User Property Sheets
      7. Visual C++ Directories
    2. 11. MSBuild in Visual C++ 2010, Part 2
      1. Property Pages
        1. Reading and Writing Property Values
      2. Build Customizations
      3. Platforms and Platform Toolsets
      4. Native and Managed Multi-targeting
        1. Native Multi-targeting
        2. How Does Native Multi-targeting Work?
        3. Managed Multi-targeting
      5. Default Visual C++ Tasks and Targets
        1. Default Visual C++ Tasks
        2. Default Visual C++ Targets
        3. ImportBefore, ImportAfter, ForceImportBeforeCppTargets, and ForceImportAfterCppTargets
      6. Default Visual C++ Property Sheets
      7. Migrating from Visual C++ 2008 and Earlier to Visual C++ 2010
        1. IDE Conversion
        2. Command-Line Conversion
          1. Devenv.exe
          2. Vcupgrade.exe
      8. Summary
    3. 12. Extending Visual C++ 2010
      1. Build Events, Custom Build Steps, and the Custom Build Tool
        1. Build Events
        2. Custom Build Step
        3. Custom Build Tool
      2. Adding a Custom Target to the Build
      3. Creating a New Property Page
        1. Troubleshooting
      4. Creating a Build Customization
      5. Adding a New Platform and Platform Toolset
      6. Deploying Your Extensions
  12. VI. Team Foundation Build
    1. 13. Team Build Quick Start
      1. Introduction to Team Build
        1. Team Build Features
        2. High-Level Architecture
      2. Preparing for Team Build
        1. Team Build Deployment Topologies
        2. What Makes a Good Build Machine?
        3. Installing Team Build on the Team Foundation Server
        4. Setting Up a Build Controller
          1. Installing Prerequisites
          2. Installing a Build Controller
          3. Configuring a Build Controller After Installation
        5. Setting Up a Build Agent
          1. Installing Prerequisites
          2. Installing a Build Agent
          3. Configuring a Build Agent After Installation
        6. Drop Folders
      3. Creating a Build Definition
        1. General
        2. Trigger
          1. Manual
          2. Continuous Integration
          3. Gated Check-in
          4. Schedule
        3. Workspace
        4. Build Defaults
        5. Process
        6. Retention Policy
      4. Working with Build Queues and History
        1. Visual Studio
          1. Queuing a Build
          2. Queuing a Private Build
          3. Build Explorer
          4. Cancelling, Stopping, Postponing, and Reprioritizing Builds
          5. Viewing Build Details
          6. Changing Build Qualities
          7. Retaining Builds
          8. Deleting Builds
        2. Working with Builds from the Command Line
          1. Queuing a Build
          2. Stopping a Build
          3. Deleting a Build
      5. Team Build Security
        1. Service Accounts
        2. Permissions
    2. 14. Team Build Deep Dive
      1. Process Templates
      2. Default Template
        1. Logging
        2. Build Number
        3. Agent Reservation
        4. Clean
        5. Sync
          1. Triggered Builds
          2. Private (aka Buddy) Builds
        6. Label
        7. Compile and Test
          1. Compile
          2. Test
        8. Source Indexing and Symbol Publishing
          1. Source Indexing
          2. Symbol Publishing
        9. Associate Changesets and Work Items
        10. Copy Files to the Drop Location
        11. Revert Files and Check in Gated Changes
        12. Create Work Items for Build Failure
      3. Configuring the Team Build Service
        1. Changing Communications Ports
        2. Requiring SSL
        3. Running Interactively
        4. Running Multiple Build Agents
        5. Build Controller Concurrency
      4. Team Build API
        1. Creating a Project
        2. Connecting to Team Project Collection
        3. Connecting to Team Build
        4. Working with Build Service Hosts
          1. Querying Build Service Hosts
        5. Working with Build Definitions
          1. Querying Build Definitions
          2. Creating a Build Definition
        6. Working with Builds
          1. Queuing a Build
          2. Querying Build Queues
          3. Querying Build History
    3. 15. Workflow Foundation Quick Start
      1. Introduction to Workflow Foundation
        1. Types of Workflows
        2. Building a Simple Workflow Application
          1. Running the Application
      2. Workflow Design
        1. Built-in Activities
          1. Sequence
          2. DoWhile
          3. ForEach<T>
          4. If
          5. Parallel
          6. ParallelForEach<T>
          7. Pick
          8. PickBranch
          9. Switch<T>
          10. While
        2. Working with Data
          1. Arguments
          2. Running the Application
          3. Variables
          4. Imports
        3. Exception Handling
          1. TryCatch
          2. Global Exception Notification
        4. Custom Activities
          1. Creating a Custom Activity
      3. Workflow Extensions
        1. Persistence
        2. Tracking
      4. Putting It All Together—Workflow Foundation Image Resizer Sample Application
        1. Overview
        2. Building the Application
        3. Running the Application
        4. Debugging the Application
        5. Summary
    4. 16. Process Template Customization
      1. Getting Started
        1. Creating a Process Template Library
        2. Creating a Custom Activity Library
      2. Process Parameters
        1. Defining
        2. Metadata
        3. User Interface
        4. Supported Reasons
        5. Backward and Forward Compatibility
      3. Team Build Activities
        1. AgentScope
        2. CheckInGatedChanges
        3. ConvertWorkspaceItem/ConvertWorkspaceItems
        4. ExpandEnvironmentVariables
        5. FindMatchingFiles
        6. GetBuildAgent
        7. GetBuildDetail
        8. GetBuildDirectory
        9. GetBuildEnvironment
        10. GetTeamProjectCollection
        11. InvokeForReason
        12. InvokeProcess
        13. MSBuild
        14. SetBuildProperties
        15. SharedResourceScope
        16. UpdateBuildNumber
      4. Custom Activities
        1. BuildActivity Attribute
        2. Extensions
      5. Logging
        1. Logging Verbosity
        2. Logging Activities
        3. Logging Programmatically
        4. Adding Hyperlinks
        5. Tracking Attributes
        6. Exceptions
      6. Deploying
        1. Process Templates
        2. Custom Assemblies
        3. Downloading and Loading Dependent Assemblies
  13. VII. Web Development Tool
    1. 17. Web Deployment Tool, Part 1
      1. Web Deployment Tool Overview
      2. Working with Web Packages
        1. Package Creation
        2. Installing Packages
          1. Installing Packages Using IIS 7
          2. Installing Packages Using MSDeploy.exe
      3. msdeploy.exe Usage Options
      4. MSDeploy Providers
      5. MSDeploy Rules
      6. MSDeploy Parameters
        1. –declareParam
          1. –declareParam kind Argument
          2. –declareParam scope Argument
          3. –declareParam match Argument
          4. –declareParam defaultValue Argument
          5. –declareParam tags Argument
        2. –setParam
      7. MSDeploy Manifest Provider
    2. 18. Web Deployment Tool, Part 2
      1. Web Publishing Pipeline Overview
      2. XML Document Transformations
      3. Web Publishing Pipeline Phases
        1. Excluding Files
        2. Including Additional Files
        3. Database
    3. 19. Web Deployment Tool Practical Applications
      1. Publishing Using MSBuild
      2. Parameterizing Packages
        1. Using MSBuild to Parameterize the Created Package
        2. Using Parameters.xml to Parameterize the Create Package
      3. Using –setParamFile
      4. Using the MSDeploy Temp Agent
      5. Deploying Your Site from Team Build
      6. Deploying to Multiple Destinations Using Team Build
      7. Excluding ACLs from the Package
      8. Synchronizing an Application to Another Server
  14. A. New Features in MSBuild 4.0
    1. Support for Visual C++
    2. New Command-Line Switches
    3. New Reserved Properties
    4. BeforeTargets and AfterTargets
    5. ImportGroup
    6. Import Wildcard
    7. Solution Import Files
    8. Property Functions
    9. Item Functions
    10. Inline Tasks
    11. Cancellable Builds
    12. YieldDuringToolExecution
    13. New Object Model
    14. Debugger
  15. B. Building Large Source Trees
  16. C. Upgrading from Team Foundation Build 2008
    1. Upgrade Process
    2. Upgrade Template
  17. D. About the Author
  18. E. Best Practices for Software Engineering
    1. Also See
  19. F. Collaborative Technologies—Resources for Developers
  20. G. For C# Developers
  21. H. For Visual Basic Developers
  22. Index
  23. About the Authors
  24. Copyright