msbuild: Building solution with forced out-of-proc nodes fails

๐Ÿ“ Iโ€™m not sure weโ€™re going to be very motivated to fix this, but it cost me a lot of time debugging bootstrapped-build failures in #3365, so Iโ€™m filing it.

Steps to reproduce

Build a solution using the MSBuild task

<Project>
 <Target Name="BuildSln">
  <MSBuild Projects="some.sln" BuildInParallel="true" />
 </Target>
</Project>

While using MSBUILDNOINPROCNODE, this results in an error

S:\msbuild\some.sln(2,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 2, position 1.

Why?

Solution metaprojects are built based on an in-memory instance which isnโ€™t transferable. See

https://github.com/Microsoft/msbuild/blob/2a012e653766eb261b09b29b3106f4eb57a7f61d/src/Build/BackEnd/Components/Scheduler/Scheduler.cs#L1254-L1260

So when forced to out-of-proc nodes, the solution build fails.

Environment data

msbuild /version output: 15.8.139-preview+g5951330944 for .NET Framework (also on Core)

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Setting MSBUILD_PROJECTINSTANCE_TRANSLATION_MODE to full works around this issue as it makes sure that the ProjectInstance is correctly moved to the out-of-proc node. And it looks like a lead to a reasonable fix as well.

  1. Make ProjectInstance.TranslateEntireState return true for meta projects.
  2. Remove the assert.