如何通过 MSBuild 将参数传递给编译器? [英] How can I pass a parameter through MSBuild to the compiler?

查看:23
本文介绍了如何通过 MSBuild 将参数传递给编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的代码让 MSBuild 构建一个 Delphi 2010 groupproj:

I'm using the line below to have MSBuild build a Delphi 2010 groupproj:

   MSBuild C:srcmyprojgroup.groupproj  /target:Build /p:config=Release

我不知道如何修改上面的行以便我可以传递这个参数

I can't figure out how to modify the line above so that I can pass this argument

   -EC:mypath

到编译器 (bcc32.exe).

to the compiler (bcc32.exe).

我花了相当多的时间试图在网上找到它./property:name=value 似乎是我需要的,但到目前为止还没有.

I've spent a fair amount of time trying to find this on the web. /property:name=value seemed likely to be what I need, but hasn't thus far.

这是否可能,或者我现在必须了解 MSBUILD 配置文件...

Is this even possible, or do I have to learn about MSBUILD configuration files now...

推荐答案

在 Delphi 中更改构建配置,或在 .DPROJ 文件中手动更改.如果您在其中任何一个地方更改发布配置本身,就可以了.

Change your build configuration within Delp or manually yourself in the .DPROJ file. If you change the Release config itself in either of those places, you'll be fine.

或者,查看 .dproj 文件并查看所需设置的名称(例如,IncludePath"或OutputDir").然后,您可以使用 msbuild 的/property 开关.例如:

Alternately, look at the .dproj file and see what the setting you want is called (eg., "IncludePath" or "OutputDir"). You can then use msbuild's /property switch. For example:

msbuild /property:WarningLevel-2;OutputDir=binDebug myproj.dproj

您可以在命令窗口提示符下使用以下命令查看这些命令行开关和示例:

You can see these command-line switches and examples using the following from a command window prompt:

msbuild /? | more

快速检查 D2007 中的 .dproj 文件表明您可能正在寻找 DCC_IncludePathDCC_UnitSearchPath 属性.

A quick check of a .dproj file from D2007 indicates you're probably looking for either the DCC_IncludePath or DCC_UnitSearchPath properties.

这篇关于如何通过 MSBuild 将参数传递给编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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