Node Reuse in MultiProc MSBuild

Greetings MSBuilders!

 

With the MultiProc support in MSBuild Orcas (now available in Visual Studio Orcas Beta 1), we’ve added the ability to reuse the MSBuild child nodes between builds. When you’re doing multiple builds in a row, this helps reduce your total build time, by avoiding the start up costs of each child node. By default, when doing a MultiProc build (using /m:2 or greater), nodeReuse is enabled.

 

Example: You have dirs.proj (a traversal project) that builds p1.proj, p2.proj, and p3.proj. Using the following command line to /m:3 dirs.proj

 

You will get 3 MSBuild nodes started, one parent node with 2 child nodes. The 2 child nodes will, by default in this example, remain after your build completes. If you were to build again (same projects, or different, with 2 or more nodes), the 2 child nodes will be re-used by that build.

 

Things to know with nodeReuse. The timeout value for these child nodes is 60 seconds if they remain idle, before they will be terminated. Because of these 60 second timeout, if you’re not doing multiple builds, you can disable nodeReuse (/nr:false) to avoid the extra processes from running after your build completes. If a node was started by another user or the same user with different elevation access (Vista), those child nodes will not be reused. You can only reuse a node that you created with the same level of access that they were started in.

 

[ Author: Eric, MSBuild Software Engineer ]