How to do a parallel build in Visual Studio 2013?
Asked Answered
N

1

12

According to this MSDN article:

http://msdn.microsoft.com/en-us/library/cyz1h6zd.aspx

one "can run multi-processor builds for C++ and C# projects." using the IDE. My solution contains only C# projects, but when I do "Build Solution" I can only see one MSBuild process in task manager and one csc.exe process.

In Tools -> Options -> Projects and Solutions -> Build and Run I have "maximum number of parallel project builds" set to 4 and my computer has 4 cores.

Is it possible to setup VS2013 to build my solution projects in parallel?

Nonrigid answered 7/5, 2014 at 16:40 Comment(7)
A process can spawn multiple threads. Parallel project builds also depend on your dependencies between projects.Lorianne
msbuild and csc processes I see never consume more than 25% cpu, so I still suspect it does not multithreadNonrigid
@user2249570 There is a lot more to multithreading than CPU usage. As BlueM said, if your projects have a high degree of dependency then MSBuild won't be able to parallelize them. What is the original problem? Is it taking a very long time for your projects to build?Gush
It is not that bad right now in terms of how much time does it take, but if this feature is available I want to take advantage of it. Even if I shave 30 sec from one build it adds upNonrigid
Try from command line with MSBuild /m. It should spawn 4 MSBuild processes.Lorianne
This question #1509897 seems highly related to your problem. If MSFT didn't improve this you face the same problem. But as said, if you build from command line you should be fine.Lorianne
Yes, I can do it from command line. That's the way I've been doing it since VS2008, I just thought that finally this feature became a part of IDE. I checked the question you referenced and it is about VS2008 which did not have an official support for parallel builds. VS2013 seems to have it, but I am not sure if I have to specifically enable it somehow or if it is supposed to work by default. I guess I will have to do a clean test on "hello world" solution to see if it works, maybe my solution is special in a way that all projects have to be build sequentially.Nonrigid
L
16

I tested the option you mentioned on my larger solution with lot of independend projects in VS2013 and it builds these projects in 4 newly spawned build processors.

enter image description here

If your projects depend on each other the build will have difficulty to run concurrently. But it basically does work in VS2013.

For reference this is the setting: enter image description here

Putting 8 in there spawned 8 build processors.

Lorianne answered 7/5, 2014 at 19:23 Comment(1)
Thank you! I guess I am just not lucky with my current solution then. It's great that they finally implemented it as a default option.Nonrigid

© 2022 - 2024 — McMap. All rights reserved.