如何在 MSBuild 中并行运行任务 [英] How to run tasks in parallel in MSBuild

查看:29
本文介绍了如何在 MSBuild 中并行运行任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除非我严重误解了 MSBuild,否则任务将按照它们出现在目标"节点中的文档顺序执行.

Unless I've grossly misunderstood MSBuild, tasks are executed in the document order in which they appear within a 'Target' node.

我希望能够指定两个任务(例如 xcopy 任务)可以并行运行.我原以为会有并行"任务之类的......?

I'd like to be able to specify that two tasks (such as xcopy tasks) could run in parallel. I was expecting there to be a 'Parallel' task or something...?

推荐答案

如前所述,您无法在任务级别甚至在目标级别进行并行化.MSBuild 只会并行构建项目(即 MSBuild 项目文件).因此,您必须对指定的多个项目使用 MSBuild 任务BuildInParallel 属性应设置为 true.还要确保在命令行上调用构建时/m 开关被发送.

As was stated, you cannot parallelise at the task level or even at the target level. MSBuild only will build projects (i.e. MSBuild project files) in parallel. So you have to use the MSBuild task with multiple projects specified and the BuildInParallel attribute should be set to true. Also make sure that when the build is invoked on the command line that the /m switch is sent it.

我的书:微软构建引擎内部:使用 MSBuild和团队基础构建

这篇关于如何在 MSBuild 中并行运行任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆