Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Team Foundation
 How to: Configure Team Foundation B...
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Team System
How to: Configure Team Foundation Build for an Incremental Build

Updated: November 2007

An incremental build reuses the results of a previous build maintained by Team Foundation Build to perform an optimized build based on the changes since the last build.

After you create a build definition for incremental builds, run the first build. This creates the required workspace and gets all the source files onto the build computer.

Prerequisites

Before you complete this task, you must have the following:

  • Access to the TFSBuild.proj file of the build type you want to customize.

    Each team build definition has an associated TFSBuild.proj file that is located in the folder $/MyTeamProject/TeamBuildTypes/MyBuildName in Team Foundation version control. MyTeamProject is the name of your team project. It is the root node of all your team project sources. MyBuildName is the name that you gave to your build definition. For more information about how to create Team Foundation Build build types, see How to: Create a Build Definition.

  • A local workspace that contains your team project files and the build files on the local computer.

    For more information, see How to: Create a Mapped Workspace and How to: Get the Source for Your Team Project.

Required Permissions

To complete this task, you must have the Administer a build and Administer workspaces permission set to Allow. You must also have the Check in and Check out permissions set to Allow. For more information, see Team Foundation Server Permissions.

Before you change the TFSBuild.proj file that defines your build definition, you must get a local copy.

To get a local copy of TFSBuild.proj file

  1. On the View menu, select Other Windows, and then select Source Control Explorer.

  2. In Source Control Explorer, click Workspaces on the toolbar, and then select your workspace from the list.

  3. Open a team project folder that contains your build type, and then expand the TeamBuildTypes folder.

  4. Right-click the TFSBuild.proj file, and select Get Latest Version to copy the latest version of the file.

    For more information, see How to: Get the Source for Your Team Project.

To specify an incremental build, you must set the IncrementalBuild property in the TFSBuild.proj file.

To set properties in the TFSBuild.proj file

  • IncrementalBuild is a convenience property that sets SkipClean to true, SkipInitializeWorkspace to true, and ForceGet to false.

  • When Team Foundation Build performs a full build, it cleans the files in the intermediate build folder and sources folder in Clean target. In an incremental build this target must be skipped because these files must be intact for the next build. To achieve this, SkipClean is set to true.

  • As a part of a full build, Team Foundation Build deletes the old, and recreates a new workspace to clean and synchronize the source files. In an incremental build, this target must be skipped also. To achieve this, SkipInitializeWorkspace is set to true.

  • In the Get task, Team Foundation Build by default retrieves new source files and overwrites the existing files in the build workspace. To only retrieve the changed files, the property ForceGet is set to false.

    To set IncrementalBuild property to true, add the PropertyGroup definition to the end of the TFSBuild.proj file, before the closing </project> tag.

    </ItemGroup>
       <PropertyGroup>
          <IncrementalBuild>true</IncrementalBuild>
    
       </PropertyGroup>
    </Project>
    
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
value of property ignored?      Steve Nuchia   |   Edit   |  
I've had trouble conditionalizing the setting of the IncrementalBuild property. I'm not sure yet but it looks like both "false" and a property element with a false condition give me a broken build rather than a full build. I can comment out the property element and get back to a working full build. Fix this please!
Tags What's this?: Add a tag
Flag as ContentBug
update on above issue      Steve Nuchia   |   Edit   |  

The fix for the problem problem I was having is to specify the workspace name in the .proj file. Otherwise it spins up a new name during initialization and the world breaks.

Meanwhile, I've discovered that it is not easy to coordinate an incremental build series with unrelated builds on the same server. The other builds want to wipe out the build agent's Sources and Binaries folders. I've not yet worked out a satisfactory design pattern to address this.

Another tip: there's no way to override a property from the automatic build triggerins, but you can override it when manually scheduling a build or using the command line tool. So make the value of IncrementalBuild in the .proj file be the one you want your automatic builds to use (probably true) and override it using /p:IncrementalBuild=false when you want a full build. This will allow you to use the same build definition for incremental CI builds and scheduled full builds (via scheduled tasks calling tfsbuild.exe).

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker