Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010, how to build projects in parallel on multicore

Tags:

I have a big solution with more than 40 projects. Almost half of them are test projects. In my project we use both Code Contracts, Code Analysis, Style Analysis. I want to be able to build the projects that are not dependent in parallel on my quad core CPU.

How can I setup msbuild to build the projects in parallel?

like image 388
thomas nn Avatar asked May 17 '10 12:05

thomas nn


People also ask

Does MSBuild use multiple cores?

MSBuild can take advantage of systems that have multiple processors, or multiple-core processors. A separate build process is created for each available processor. For example, if the system has four processors, then four build processes are created.

Is MSBuild multithreaded?

I know that MSBuild can do multithreaded build of projects in a solution.

How do I create multiple projects in MSBuild?

You can use MSBuild to build multiple projects faster by running them in parallel. To run builds in parallel, you use the following settings on a multi-core or multiple processor computer: The -maxcpucount switch at a command prompt. The BuildInParallel task parameter on an MSBuild task.

How do you clean MSBuild solution?

Cleaning up specific projects: msbuild MyProjectFile1 /t:Clean msbuild MyProjectFile2 /t:Clean ... This has to be repeated for all projects you need to clean, because MSBuild only accepts single project on command line.


1 Answers

In Visual Studio: Tools | Options | Projects and Solutions | Build and Run. This should default to your CPU count.

From the command line: msbuild /maxcpucount[:n] (is n is not specified, then it will use the CPU count).

like image 155
Richard Avatar answered Sep 17 '22 19:09

Richard