One of the challenges we face at TrackAbout is the speed of our builds. TrackAbout Mobile, our compact framework app that runs on rugged Windows CE devices, would take between one and two minutes to do an incremental build. If you add on the time to run unit tests, or deploy to an emulator and start testing manually, the development cycle really starts to slow down. Since Jeff and I have been experimenting with doing “TDD like you mean it”, this was really a pain.
As it turns out, there is an easy way to speed up builds that use the compact framework. One of the “features” that Microsoft provides for compact development is a platform verification check. This check verifies that all of the features of the .NET framework that you use are available on the platform you are targeting with your code. That’s so you don’t deploy some code to a device that just explodes when it tries to access a non-existent property in the compact framework, which actually exists in the full .NET framework.
And this little step takes the majority of our build times. Although it’s definitely something we want to have run, it’s not something we need to have run on each build of our app. So to speed up our builds we made it a conditional step and made it possible for the developers to turn it off on their debug builds. First, we checked in a change to our project files that set a new property (SkipPlatformVerification) to true in debug builds. Then, when an individual developer gets sick and tired of slow builds, they can go to their MSBuild targets file and change a single line to make the PlatformVerificationTask conditional on that variable.
To enable slower builds, they just need to modify one line in the C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.Common.targets file.
The line:
Name="PlatformVerificationTask">
Should become
Name="PlatformVerificationTask" Condition="'$(SkipPlatformVerification)' != 'true'" >
By making the suppression of that task dependent on action by developers, it means all our official builds (from our jenkins server) still do the task. By making it only happen in debug builds, its still easy for developers to make sure their code will run on the compact framework. And by making it possible to skip the step in daily development, we sped up our normal build times from 1-2 minutes down to 5-25 seconds.
The other day I was on the phone with another developer as he made the change to his targets file and rebuilt. He kicked off the build, leaned back in his chair, then freaked out because his build was already done.
It made my day.
