问题描述
大家好,
我们将构建嵌入式代码封装在MSBuild项目文件中,预定义了适当的依赖项,以并行运行它们并减少构建时间.
We encapsulated building embedded code in MSBuild project files, predefining the proper dependencies, to run them in parallel and reduce build time.
运行良好,时间明显减少,直到我们注意到使用CTRL-BREAK终止命令行构建导致主MSBuild.exe进程停止,但子进程继续运行.使用Process Explorer,您可以看到 生成的MSBuild(通过Exec任务)如何在后台运行.我认为一旦完成被调用的任务,它们就会消失.无论如何,如果开发人员尝试启动另一个构建,这将是有问题的.
It was working beautifully with significant reduction in time until we noticed that terminating the command-line build with CTRL-BREAK caused the main MSBuild.exe process to stop but the child processes kept on running. Using Process Explorer, you can see how the MSBuild-spawned (via the Exec task) kept on running in the background. I assume they would go away once the called task is done. Anyway, this would be problematic if the developer tried to initiate another build.
我的问题是:
- 这是取消构建的预期行为吗?对于Visual Studio项目的并行编译,是否也存在此问题?
- 是否有更干净的方法来取消构建? (父MSBuild进程是否以某种方式指示子进程停止?)
- Is this the expected behavior from canceling a build? Does this problem exist for parallel compilation of Visual Studio projects as well?
- Is there a cleaner way to cancel the build? (Have the parent MSBuild process somehow signal the child ones to stop?)
我假设,如果一个Exec任务调用进程之一自然失败,那么构建将正常停止(所有MSBuild进程都将消失).
I assume if one of the Exec task-called processes failed naturally, then the build would stop gracefully (all MSBuild processes disappear).
提前谢谢!
推荐答案
感谢您的信息.
我想您将MSBuild封装到项目中以实现并行构建工具,
如果是这样,我想您可以创建一个新的线程来构建而不是建立进程,以避免该问题.
有关更多信息, http://social.msdn.microsoft.com/Forums/en -US/msbuild/thread/ec9ada90-2cbb-4060-8171-817375fe48e2
for more information,http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/ec9ada90-2cbb-4060-8171-817375fe48e2
如果我误解了您的问题,请随时告诉我.
最好的问候,
Best Regards,
Ziwei Chen
Ziwei Chen
这篇关于并行生成终止使子MSBuild.exe进程运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!