[This blog was written by my colleague: Prabhat Tandon]
We know that building in parallel feature is not new in MSBuild.
Here is how it works. When we start a build using IDE/command-line options, the first instance or the parent MSBuild instance starts. The project / solution dependency graph suggests if parallel builds can be spawned or not. If yes, the parent MSbuild process spawns several new instances.
Between the child and the parent instances, there is a handshaking that needs to take place.
In case of unsuccessful handshaking, newer instances cannot be spawned and ultimately the entire build process may fail. It was felt that we should know where the failure is.
Following is the basic criteria for successful handshaking:
Recently I was working on an issue where an antivirus was interrupting the build process and we were getting MSB4014 error.
MSbuild team has come up with a logging mechanism which can help us diagnose whether the handshaking between different instances of MSBuild is successful or not.
This mechanism is dependent on the environment variable MSBUILDDEBUGCOMM which enables tracing.
Here is how we can do this:
A typical successful build may produce something like :
Waiting for connection 900000 ms...Handshaking with host..Entering read loop.
This may help us to determine if there is any blockage occurring in the communication between the Visual Studio IDE and its external nodes which are used to build C++ projects.
P.S. – This option may change / be removed in future versions of MSbuild.