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

查看:239
本文介绍了如何在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.

我的书:在Microsoft Build Engine内部:使用MSBuild和团队基础建设

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

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