Optimising Visual Studio Build Times


At my current workplace we have 203 projects in a single tanged web of a solution. This unfortunately means the majority of projects need to be built for any of the services or sites to function, thus breaking down the solution is not a viable solution at the moment. So I took a look at reducing those build times, and here are my results:

Rebuilding your solution

Running a rebuild in visual studio 2008 takes… 

7:42 minutes

*Sigh* Let’s try the same thing in the Visual Studio 2008 Command prompt:

Msbuild.exe mysolution.sln /t:rebuild

2:39 minutes

*Wow* Let’s add some tweaks, first up is the multicore build tweak.

Msbuild.exe mysolution.sln /t:rebuild /m

1:25 minutes

*Pretty cool* There’s a strange bug in the normal command line which slows down execution of running programs. So let’s use a filelogger instead of a console logger.

Msbuild.exe mysolution.sln /t:rebuild /m /noconsolelogger /fl

Try it out and see if you get a decent benefits!

Building your solution

Running a normal build inside Visual Studio takes:

3:10 minutes

And using the command line:

Msbuild.exe mysolution.sln /t:build

27 Seconds

Now with the multicore tweak:

Msbuild.exe mysolution.sln /t:build /m

12 Seconds

So all in all not a bad way to manage a solution with 203 projects in it!

Happy deving…

July 16 2011
Older Posts