{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/msbuild/issues/3420","repository_url":"https://api.github.com/repos/Microsoft/msbuild","labels_url":"https://api.github.com/repos/Microsoft/msbuild/issues/3420/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/msbuild/issues/3420/comments","events_url":"https://api.github.com/repos/Microsoft/msbuild/issues/3420/events","html_url":"https://github.com/Microsoft/msbuild/issues/3420","id":333354784,"node_id":"MDU6SXNzdWUzMzMzNTQ3ODQ=","number":3420,"title":"BuildSubmission.Execute() starts one MsBuild child process per project to compile (without re-usage)","user":{"login":"Pilchie","id":312835,"node_id":"MDQ6VXNlcjMxMjgzNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/312835?v=4","gravatar_id":"","url":"https://api.github.com/users/Pilchie","html_url":"https://github.com/Pilchie","followers_url":"https://api.github.com/users/Pilchie/followers","following_url":"https://api.github.com/users/Pilchie/following{/other_user}","gists_url":"https://api.github.com/users/Pilchie/gists{/gist_id}","starred_url":"https://api.github.com/users/Pilchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pilchie/subscriptions","organizations_url":"https://api.github.com/users/Pilchie/orgs","repos_url":"https://api.github.com/users/Pilchie/repos","events_url":"https://api.github.com/users/Pilchie/events{/privacy}","received_events_url":"https://api.github.com/users/Pilchie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-18T16:55:23Z","updated_at":"2018-06-19T07:22:31Z","closed_at":null,"author_association":"MEMBER","body":"_From @ocox1 on June 18, 2018 15:23_\n\nMy 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:\r\n\r\n  <ItemGroup>\r\n    <ProjectList Include=\"**\\*.vcxproj;**\\*.csproj\" />\r\n  </ItemGroup>\r\n  <Target Name=\"Build\" DependsOnTargets=\"Init\" Outputs=\"@(OutputList)\">\r\n    <MSBuild\r\n        Projects =\"@(ProjectList)\"\r\n        ContinueOnError =\"$(ContinueOnError)\" StopOnFirstFailure=\"$(StopOnFirstFailure)\" \r\n        Properties=\"Configuration=$(Configuration);RunFxCop=$(RunFxCop);ToolsVersion=15.0\"\r\n        Targets=\"Build\">\r\n      <Output TaskParameter=\"TargetOutputs\" ItemName=\"OutputList\" />\r\n    </MSBuild>\r\n  </Target>\r\n\r\nIn 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).\r\nAfter 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...).\r\nIf I kill my application early enough, the MsBuild processes keep in memory for ~15 minutes.\r\n\r\nHere is a code snippet:\r\n\r\n\tProjectCollection projectCol = new ProjectCollection();\r\n\r\n\tBuildParameters buildParams = new BuildParameters(projectCol)\r\n\t{\r\n\t\tBuildThreadPriority = ThreadPriority.Highest,\r\n\t\tEnableNodeReuse = true,\r\n\t\tMaxNodeCount = Convert.ToInt32(Environment.GetEnvironmentVariable(\"NUMBER_OF_PROCESSORS\"))\r\n\t};\r\n\r\n\tBuildManager bm = new BuildManager();\r\n\tbm.BeginBuild(buildParams);\r\n\r\n\tBuildRequestData buildReq = new BuildRequestData(\r\n                                                                   projectPath, // path to build.proj\r\n                                                                   new Dictionary<string, string>\r\n                                                                                       { { \"Configuration\", \"Debug\" } }, // buildProperties\r\n                                                                   \"15.0\",\t// toolsVersion\r\n                                                                   new string[] { \"_Make\" }, // targetsToBuild\r\n                                                                   null);\r\n\tBuildSubmission buildSubmission = bm.PendBuildRequest(buildReq);\r\n\tbuildSubmission.Execute();\r\n\t//buildSubmission.ExecuteAsync(null, null);\t// same result with ExecuteAsync\r\n\r\n\t// clean up resources...\r\n\r\n![msbuildprocesses](https://user-images.githubusercontent.com/40359019/41545991-f71b369e-730b-11e8-9f75-ada970774946.png)\r\n\r\n\n\n_Copied from original issue: dotnet/project-system#3665_"},"comment":{"url":"https://api.github.com/repos/Microsoft/msbuild/issues/comments/398300606","html_url":"https://github.com/Microsoft/msbuild/issues/3420#issuecomment-398300606","issue_url":"https://api.github.com/repos/Microsoft/msbuild/issues/3420","id":398300606,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODMwMDYwNg==","user":{"login":"ocox1","id":40359019,"node_id":"MDQ6VXNlcjQwMzU5MDE5","avatar_url":"https://avatars0.githubusercontent.com/u/40359019?v=4","gravatar_id":"","url":"https://api.github.com/users/ocox1","html_url":"https://github.com/ocox1","followers_url":"https://api.github.com/users/ocox1/followers","following_url":"https://api.github.com/users/ocox1/following{/other_user}","gists_url":"https://api.github.com/users/ocox1/gists{/gist_id}","starred_url":"https://api.github.com/users/ocox1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocox1/subscriptions","organizations_url":"https://api.github.com/users/ocox1/orgs","repos_url":"https://api.github.com/users/ocox1/repos","events_url":"https://api.github.com/users/ocox1/events{/privacy}","received_events_url":"https://api.github.com/users/ocox1/received_events","type":"User","site_admin":false},"created_at":"2018-06-19T07:22:31Z","updated_at":"2018-06-19T07:22:31Z","author_association":"NONE","body":"Attached are the demo project and my build.prj file.\r\n[MsBuildConsole.zip](https://github.com/Microsoft/msbuild/files/2114235/MsBuildConsole.zip)\r\n.\r\n[MyBuild.zip](https://github.com/Microsoft/msbuild/files/2114229/MyBuild.zip)\r\n\r\n"}}
{"actor":{"display_login":"ocox1"}}