I'm facing a weird issue while trying to build using MSBuild.
I'm using MSBuild to build a solution file with /m
(parallel build) and BuildProjectReferences
set to true
.
Suppose I have A.vcxproj
and B.vcxproj
in the .sln file with B having a project reference to A.
What happens is: the A project
starts to build first and while it's in the middle of compiling, B project
starts to build in another process (since parallel builds) and it would invoke building A.
Now this causes a race condition because we have two processes trying to build the same project A
and I would see access issues.
Ideally, MSBuild should not invoke building B if A hasn't finished building, or if it does invoke B then detect that A is still building and wait for it to finish.
None of this happens. Also, this happens only with MSBuild - doesnt happen if I try to build the solution file from VS2015 IDE.
Any idea why MSBuild behaves this way?