I have a project configured with Visual Studios 2008. When I open the IDE and hit build, all the cores on my system are used to build the project. However, when I try and build from the command line only 1 core is used. Here is the command that I am running:
C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild VTK.sln /m /fl /tv:3.5 /p:Configuration=RelWithDebInfo
From reading the docs, it would appear that the /m switch should tell MSBuild to use all cores, but it does not. Any ideas how to make it use all the cores?
Thanks
Well, actually the
/m
option specifies the "the maximum number of concurrent processes to build with". That is, the maximum number ofmsbuild.exe
processes to start in parallel to build your projects in parallel (each process will build one project at most). Something quite different than "using all cores". Although, admittedly, the long form name of the/m
option,/maxcpucount
might hint otherwise, the description of it should give a better indication of what is going on:Now, if your Solution doesn't allow for projects to build in parallel, for example because each of your project is a dependency for another one (like P1 is required to build P2, P2 is required to project P3, etc.) you won't see any parallel builds happening. Depending on how fast builds complete, you would also not see any relevant activity on all cores (e.g. using Task Manager) because the "flickering" of the CPU graphs might not really be accurate as to what is going really on (mind a build is also pretty I/O intensive, which doesn't show looking at CPU load).
You should, however, see (for example using Process Explorer or Task Manager) a number of
msbuild.exe
processes that match the number of cores/CPUs you have (or the equivalent number that you pass as an optional number to the/m
option.You may also want to refer to this SO question . Also searching for "parallel msbuild" produces some good hits with more information.