|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
How to: Configure Team Foundation Build for an Incremental Build
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 type for incremental builds, run the first build. This creates the required workspace and gets all the source files onto the build computer.
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 type is defined by a TFSBuild.proj file that is located in the folder $/MyTeamProject/TeamBuildTypes/MyBuildName in Team Foundation source 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 type. For more information about how to create Team Foundation Build build types, see.
A local workspace that contains your team project files and the build files on the local computer.
For more information, seeand .
The appropriate security permissions. For more information, see the following section.
To perform 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.
Getting a Local Copy of the TFSBuild.proj File
Before you change the TFSBuild.proj file that defines your build type, you must get a local copy.
To get a local copy of TFSBuild.proj file
On the View menu, select Other Windows, and then select Source Control Explorer.
In Source Control Explorer, click Workspaces on the toolbar, and then select your workspace from the list.
Open a team project folder that contains your build type, and then expand the TeamBuildTypes folder.
Right-click the TFSBuild.proj file, and select Get Latest Version to copy the latest version of the file.
For more information, see.
Setting Properties in the TFSBuild.proj File
To specify an incremental build, you must set the SkipClean, SkipInitialiseWorkspace, and ForceGet properties in the TFSBuild.proj file.
To set properties in the TFSBuild.proj file
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, set the property SkipClean 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 sources files. In an incremental build, this target must be skipped also. To achieve this, set the property SkipInitializeWorkspace 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, set the property ForceGet to false.
To set all of these properties, add the PropertyGroup definition to the end of the TFSBuild.proj file, before the closing </project> tag.
</ItemGroup> <PropertyGroup> <SkipClean>true</SkipClean> <SkipInitializeWorkspace>true</SkipInitializeWorkspace> <ForceGet>false</ForceGet> </PropertyGroup> </Project>