BuildSubmission.Execute() starts one MsBuild child process per project to compile (without re-usage)
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
_From @ocox1 on June 18, 2018 15:23_
My tool gives our developers the chance to compile all our projects (~1000 projects) on their local machines. So we have a build.proj with these nodes:
In my application I try to compile these projects (contained in the ProjectList) by calling buildSubmission.Execute(). This worked fine with VisualStudio 2015 / MsBuild 14, but after migration to VisualStudio 2017 / MsBuild 15 (15.7.179) for every project from the ProjectList a new MsBuild instance is created in the background (1000 child processes in my case).
After a short time I have to kill my application before my computer collapses because more and more resources are used (some processes crashes with OutOfMemory, Explorer.exe freezes...).
If I kill my application early enough, the MsBuild processes keep in memory for ~15 minutes.
Here is a code snippet:
ProjectCollection projectCol = new ProjectCollection();
BuildParameters buildParams = new BuildParameters(projectCol)
{
BuildThreadPriority = ThreadPriority.Highest,
EnableNodeReuse = true,
MaxNodeCount = Convert.ToInt32(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"))
};
BuildManager bm = new BuildManager();
bm.BeginBuild(buildParams);
BuildRequestData buildReq = new BuildRequestData(
projectPath, // path to build.proj
new Dictionary
{ { "Configuration", "Debug" } }, // buildProperties
"15.0", // toolsVersion
new string[] { "_Make" }, // targetsToBuild
null);
BuildSubmission buildSubmission = bm.PendBuildRequest(buildReq);
buildSubmission.Execute();
//buildSubmission.ExecuteAsync(null, null); // same result with ExecuteAsync
// clean up resources...

_Copied from original issue: dotnet/project-system#3665_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.