你能阻止 MSBuild.exe 运行生成事件吗? [英] Can you prevent MSBuild.exe from running Build Events?

查看:17
本文介绍了你能阻止 MSBuild.exe 运行生成事件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过脚本构建多个项目,偶尔使用自定义构建事件会给构建系统带来很大的困难.如果可能的话,我想调用 MSBuild.exe 以阻止任何构建事件的执行.从长远来看,这对于构建自动化来说不是问题——带有构建事件的项目提交者会被预先警告,这种恶意行为是违反规则的.

I'm building a number of projects via a script, and the occasional use of custom build events causes a great deal of difficulty for the build system. If it is possible, I'd like to invoke MSBuild.exe in such a was as to block the execution of any build events. In the long run, this is not an issue for build automation - submitters of projects with build events are forewarned that such snafuery is against the rules.

简而言之,有没有一种方法可以调用 MSBuild 来阻止执行任何自定义构建步骤(如果存在)?

In short, is there a way to call MSBuild that will prevent the execution of any custom build steps, if present?

更新:

我考虑过对项目文件进行就地(自动)编辑,但更喜欢将三个中的每一个都设置为从构建中排除"(请参阅​​构建事件选项)的命令行等效项事件.

I'd considered doing an in-place (automated) edit of the project files, but would prefer the command-line equivalent of setting "Excluded From Build" (see the Build Events options) to Yes for each of the three events.

推荐答案

Pre/PostBuildEvents 是属性,所以要覆盖它们,只需从命令行将它们设置为空字符串.

Pre/PostBuildEvents are properties, so to override them just set them from command line to empty string.

msbuild foo.sln /p:PreBuildEvent= /p:PostBuildEvent=

这篇关于你能阻止 MSBuild.exe 运行生成事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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