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

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

问题描述

我正在使用下面的行让MSBuild建立Delphi 2010 groupproj:

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

   MSBuild C:\src\myprojgroup.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的/属性开关。例如:

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=bin\Debug myproj.dproj

您可以从命令窗口提示中使用以下命令行开关和示例:

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

msbuild /? | more

从D2007快速查看.dproj文件表示您可能正在寻找 DCC_IncludePath DCC_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天全站免登陆