With continuous integration being integrated into Team Foundation Server 2008 we can sometimes run into unexpected results. Such as extended build times. By default the build file is set up to inform the TFS Build Agent that it should perform a “Full Build”.
What is a “Full Build”?
By default, when TFS performs a build the following events happen:
- Clean – When Team Foundation Build performs a full build, it cleans the files in the intermediate build folder and sources folder in Clean target.
- Workspace Initialization – 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.
- Get – In the Get task, Team Foundation Build by default retrieves new source files and overwrites the existing files in the build workspace.
A Possible Issue
A full build can have consequences that can be considered “non-optimal” (this is very subjective in many circles), but in my opinion coming from a Cruise Control .NET background, I DO NOT want full builds.
If my source code repository is very large, cleaning the files, re-creating the workspace and then getting all the files again can be a real pain in the “time” category. I’ve had builds on my local dev machine (which is in a VPC) take 15-20 seconds to build using Visual Studio. I’ve even run the same build from the command line using MSBuild using the .proj file and its taken less than 15 seconds for he same build (~15 Visual Studio Projects in the solution).
However, this same build using TFS would take nearly 20+ minutes!
Wowzers… The reason the build took so long in TFS is because it was utilizing the FULL Build.
Core Concept
One of the core concepts is “Keep The Build Fast“. We’re looking for frequent feedback. 20 minutes (IMO) is not quick feedback (if the build takes 15-20 seconds on my machine). We should be able to get this down to under 10 minutes at the worst, but my goal is to get it well under 5 minutes (closer to 2 minutes).
Enabling TFS 2008 Incremental Builds
In Team Foundation Server 2008, we can change this behavior with a simple change in the TfsBuild.proj file under the TeamBuildTypes directory in TFS. Here’s how:
- Open the TfsBuild.proj file for the build in question
- Add the following XML:
This will enable Team Build to treat this build as an incremental build.
What does this exactly do behind the scenes?
IncrementalBuild is a convenience property that sets SkipClean to true, SkipInitializeWorkspace to true, and ForceGet to false.
Since clean is skipped, the files will not be deleted. Since SkipInitailizeWorkspace is skipped, the workspace will not be deleted and recreated and since ForceGet is disabled, the files will not be overwritten with the files from Source Control. What this will do is perform a regular “Get” on the existing workspace which will only get the changed files.
Result
A huge performance improvement. The previous ~20 minute build dropped to about 4 minutes. There are some other improvements I could do to improve the performance,but at this time its 5 times as fast. Excellent. 🙂 Why did it improve this much? Simple: Less disk I/O. Disk I/O = slow.
Disclaimer: This may not be desired. For example, build that is specified for “Production” you might want a “Full Build” in order to simulate a production release. You may have tasks in your build file that need a clean build. But for Continuous integration on the project, this setting is highly desirable.
Yangzhifang2006 says
私たちは今まで、語る春トレンドのハンドバッグの明らかなように、がたくさんあります。私たちを持った コーチ アウトレットとcoach バッグコーチ アウトレット、今日私はあなたに教えるのはもうひとつ傾向;花卉の模様が入っている。私たちは普段はこのコーチはコーチ バッグコーチの財布がなくて、しかし私はこのpurseblogの特徴がありす。コーチ 財布,コーチ サングラス,コーチ トート
haha says
authentic nfl jerseys Inexpensive items
coach bags on sale I am confident with his
coach outlet store online First step in success
coach outlet online Workmanship
coach bags outlet Value of goods
coach outlet store Of love
wholesale designer bags Beautiful lines
coach bags outlet There range of children
cheap coach What are you waiting
wholesale nfl jerseys Is always expected
authentic nfl jerseys It is pretty good