Visual Studio Team System
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.

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 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 How to: Create a New Build Type.

  • 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 Workspace and How to: Get the Source for your Team Project.

  • The appropriate security permissions. For more information, see the following section.

Required Permissions

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 Team Foundation Server Permissions.

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

  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.

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>

See Also

Tags : system team


Community Content

ralfkret
This only works until you delete a project!
This will stop working when you will ever delete a project (for example a C# project) that has been built at least once from the Team Foundation Project. The next Get operation on the build server will try to remove the project folder from the build dir. It does so quite cleverly by removing all the files it knows about in a bottom up manner. Unfortunately there are some files created by the previous build, that Source Control does know nothing about. The last build left something like "obj\debug" behind. When the SC Get operation tries to remove the directory that contains "obj\debug" the operation fails and so the build breaks. You have to manually delete the directory from the build dir to make the build work again.
I would not bother with incrememtal builds anyway if you are looking for a fast build. There is much more time wasted by the build service by transmitting the current build status to the tfs server than by recompiling the sources.
Tags :

Noelle Mallory - MSFT
Incremental build or Incremental Get?

From what i can gather from reading this and just trying it out this is just an incremental get. All the projects are re-built irrespective of whether there was a change in the project....

Am i missing a setting that stops MSBuild re-build the solutions?

[Noelle Mallory - MSFT] Please post questions to the MSDN Forums at http://forums.microsoft.com/msdn. You will likely get a quicker response through the forum than through the Community Content.

Tags :

Page view tracker