How to speed up or stop a build in progress in Visual Studio

Stopping a build

If you are working on a Grown-Up Solution, that has lots of projects, and takes days to build (OK, slight exaggeration, but you know the feeling!), you might sometimes want to cancel a build. This usually happens when you’ve just changed something, started a build and then realised you needed to do something else before trying to build. It’s very frustrating sitting there waiting for VS to finish the build, only to tell you in a smarmy voice that the build failed. “Yes, I know the build failed, that’s why I wanted to stop it you condescending computer!” It’s at this point that you feel like smacking it in the face (or monitor), but you don’t, because you are too polite.

What you would really like to do is stop the build. Thankfully there are a few ways to do this, presented here in reverse order of usefulness:

  • Shoot the computer / pull out the mains plug. This is generally known as the Bad Method.
  • Click the Build menu and choose Cancel Build. This is a nice idea, but if you’ve ever tried it, you’ll know that VS rarely responds to anything during a build, so you’d be very lucky to get this to work.
  • Finally, announcing the prize winner, you can just click Ctrl-Break on your keyboard. Yes, finally a use for the Break key!

It’s worth noting that this may or may not work, depending on what window or panel has the focus when you started the build. If it doesn’t work, try clicking in the code window with your mouse before pressing Ctrl-break.

If you’re on a Dell Inspiron (and possibly other Dell lap tops, or maybe even lap tops in general), then you may need to press Ctrl-Fn-f6 (snappy combination that just trips off the tongue eh?). On some lap tops, the Pause button is used instead of Break, and you also have to hold down the Fn key to get it, so the combination ends up being Ctrl-Fn-Pause. Ho hum.

Speeding up a build

1) If you replace your hard drive with a solid state drive, you’ll notice an immediate improvement in the general performance of your machine. Disk access is way faster, meaning that programs start up much more quickly, even Windows starts more quickly, and any disk-bound activities such as a build go much more quickly. An SSD is probably the best upgrade you can give your computer!

2) If you have a virus checker installed (and if you don’t, then you have bigger problems, but that’s another story!), you can probably speed up your build by telling it to ignore the Visual Studio install directories. Quite why VS hacks away at these directories so much during a build is beyond me, but it does, and excluding them from your virus checker can make a noticeable difference to the time required for a build. The exact selection of directories will depend on which version(s) of VS you have installed, but on my machine, I have the following set:

3) Delete all breakpoints- go to Debug > Delete all breakpoints. It really speeds up the time it takes to start up.

4) If you are using ReSharper (and if you’re not, you obviously aren’t a Real Programmer) then switch to R# Build, as it’s generally a lot faster than MSBuild.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.