Monday, January 5, 2009

Optimizing the build

Continuous integration (CI) is great. You get quick feedback regarding the health of your code base. One of the tenets of CI is to keep the build fast. This seems easy but can get out of hand if you have a lot of projects to build as part of your solution. If you are using TFS build then you are in luck.

After creating your build definition, open up the TFSBuild.proj file and add the following elements as children to the <Project> element:

<PropertyGroup>

  <SkipClean>true</SkipClean>

  <SkipInitializeWorkspace>true</SkipInitializeWorkspace>

  <ForceGet>false</ForceGet>

</PropertyGroup>

These settings will speed up the build process in the following ways:

  • the build will not delete the files from the last build (SkipClean)
  • the build will not initialize the workspace, which would create and synchronize files with the folder structure associated to the workspace of the build (SkipInitializeWorkspace)
  • the build will not get all files - it will only get the files that have changed (ForceGet)

Now, these setting are not for every build definition. Sometimes you want to start clean and make the build. I'd set these for the CI build but leave them out for the daily build. You do have a daily build, eh?

No comments: