Speed Up Visual Studio Build Times

Speed Up Visual Studio Build Times

Compiling!Although compiling is still the #1 programmer excuse for slacking off, you still probably don’t want to spend more time on it than you absolutely have to.

If your Visual Studio builds take longer than you would like, there are a couple of things you can do. First, if you’re still using a spinning-metal disk drive, upgrade to an SSD. You can get a 250GB SSD for under $100 these days on Amazon, and this will improve your overall software development productivity more than any other upgrade to your hardware. Seriously, stop reading this now and go get an SSD, then come back and read the rest if that doesn’t make your performance 100% better.

Ok, now that we’re all using an SSD, check and see if your antivirus software is slowing down your builds. If you’re using the default Windows software, you’re going to be looking for Windows Defender. Open up Task Manager and watch it while you go into your Visual Studio solution and choose “Rebuild All”. Do you see something like this?


Notice that Windows Defender, also known as Antimalware Service Executable, is taking up almost as much CPU time as Visual Studio, and quite a bit more than MSBuild.exe or the VB/C# compiler service (VBCSCompiler.exe). Assuming your build takes more than a second or two, note how long it takes to run under these conditions.

Exclude Visual Studio from Windows Defender

As a quick check, run a scan to make sure you don’t have anything currently infecting your system, and then go to Windows Defender -> Settings and disable Real-time protection:


Rebuild your solution in Visual Studio, noting the total time it takes and observing in Task Manager to see if the Antimalware Service Executable appears to be consuming significant processor time. Assuming your build is faster and your CPU less busy, congratulations, you’ve identified one cause of your performance problems. The next step is to responsibly tell Windows Defender to leave Visual Studio alone without turning it off completely.

First, turn Real-time protection back on. Then, scroll down to Exclusions and choose Add an exclusion.


We’re going to exclude the devenv.exe process and your projects folder(s). First, click Exclude a folder and choose the folder(s) where your development projects reside. Next, choose Exclude a .exe process and add devenv.exe. When you’re finished, the Add An Exclusion menu should look something like this:


Close the window and return to Visual Studio. Rebuild your solution and confirm that the build times are similar to when Real-time protection was off, and that you’re no longer seeing the Antimalware Service Executable process consuming processor time during your build.

If you’re using another antivirus tool, it should provide you with similar steps for excluding certain files and programs.

Now share this with your team – they should love you for it.


  • I did this just the other day after forgetting to do it when I rebuilt my dev machine. It can make a huge difference, although I find Windows Defender is much better behaved than other AVs on the market.

  • Kasper Thorø Plougmann

    I tried this, and on windows 10, using VS2015 Antimalware still jumps to 20-30% each time I build, open a project or start debugging.
    Got any other tips?

    • I added an exclusion for MSBuild.exe and that seemed to help me a bit.

  • Aaron Lenoir

    I was having this problem too. Your tips helped a lot.

    However, tests and some other things were still very slow.

    Then I realised I left FusionLog on after enabling it for some analysis. This generates lots of files.

    This had a huge impact on the system.

    • Dan Miser

      OMG. Same issue here. I forgot to turn fuslogvw off after a debugging session. This comment makes my system fly again. Thanks!

  • Björn Ali Göransson

    Also don’t forget to exclude C:Program FilesWindows DefenderMsMpEng.exe to make the “idle” 10-20% CPU drop from malware service.

  • Fareed Ali Azam

    do any one have another worked around, that has nothing to do with exclusion list and turning windows defender off.

  • Girish Kamat

    I would not exclude folder since you are generating dlls and possibly exe files which can be infected and they accidentally become carriers. But msdev.exe and msbuild.exe are perfect candidates. But your are right. SSD is single most important tool more than every thing else put together.

  • I have finally found the simple solution to the slow build problem – my builds used to take 10 minutes, and now they take 15 seconds:

    Prior to every build,

    1 – close all forms and code windows in the dev environment
    2 – close the dev environment
    3 – delete the obj folder
    4 – re-open the dev environment
    5 – build

    Note – as I develop in WinMobile and CE, my version of VS is 2008, but I see no reason why this should not work in all versions