Just a quick note on something that helped me get my solutions builds to run faster as I develop.

First off, I’ll admit that “Faster Builds” is a bit of a stretch. I’m not actually making VS compile faster. Rather, I’m reducing the amount of time I waste waiting for a build to complete.

Time Consuming Builds…

Some solutions have a ton of stuff going on in their compilation process:

  • Numerous projects (presentation, business, data, etc)
  • Unit tests (maybe one per project)
  • Static code analysis
  • NDepend
  • Etc.

It’s relevant to point out that solutions have a certain order that they build their projects. This is automatically determined based on the inter-project references. Projects that are a dependency of many other projects must be built first. Making a change to one of these “root” projects means that everything else must be rebuilt too.

In some of these cases, building the entire solution can take some time, especially when the changes are in one of the “root” projects that is built first. I found this a bit annoying, especially when it returns with an error. But what to do? I don’t want to turn off the safety nets that the static code analysis or NDepend offers. I don’t want to unload projects or remove them from the solution.

Building Selected Projects

The thing that seems to be working well for me so far is to build individual projects. If there is an error in the DTO project’s classes, then I only have to build one or two projects to find out, rather then building the whole solution. This saves a fair bit of time because I can get the DTO project working and then move on to other projects.

Setting up the Shortcut Key

You can build a specific project by right clicking on it, or by selecting it and then using the file menu. But, again, even that is kind of annoying. I’m a fan of “CTL+SHIFT+B” to build solutions. The problem is that VS doesn’t seem to have a built in shortcut key for “Build Selected Project”. Luckily, you can change this by editing the VS options:

VS2010 Keyboard Options

By default, the “Build.BuildSelection” command has no shortcut key. I tried a couple options and settled on “ALT+B”. This didn’t appear to be in use and was relatively comfortable for me to access.

Cheers!