MSBuild任务以执行外部MSBuild文件 [英] MSBuild task to execute an external MSBuild file

查看:72
本文介绍了MSBuild任务以执行外部MSBuild文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置一个MSBuild文件,该文件将调用另一个MSBuild文件,我想知道实现此目标的最佳方法是什么.

I'm trying to set up a MSBuild file which will invoke another MSBuild file and I'm wondering what's the best way to achieve this.

我们在构建服务器下载MSBuild文件的情况下使用它,然后根据参数它将执行相应的第二个文件.

We're using it in the scenario of where a build server downloads a MSBuild file which then depending on the parameters it'll execute the appropriate 2nd file.

我知道我可以使用<Exec Command="msbuild.exe ..." />任务,但这似乎有点 hacky 的方式.

I know I can just use the <Exec Command="msbuild.exe ..." /> task, but that seems to be a bit of a hacky way to do it.

有没有更简单的方法来使用MSBuild执行另一个MSBuild文件?

Is there an easier way to use MSBuild to execute another MSBuild file?

推荐答案

您可以使用

You can use the MSBuild task to build a target in another MSBuild project.

您还可以将目标放入两个MSBuild项目导入的外部.targets文件中,并使用 CallTarget task 进行构建.

You can also put the target in an external .targets file that is imported by both MSBuild projects and use the CallTarget task to build it.

更新:要执行外部命令,请使用 Exec task .

Update: To execute an external command, use the Exec task.

这篇关于MSBuild任务以执行外部MSBuild文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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