开发者

How can I pass a parameter through MSBuild to the compiler?

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

to the compiler (bcc32.exe).

I've spent a fair amount of time trying to find this on the web. /property:name=value seemed likely to be wh开发者_高级运维at I need, but hasn't thus far.

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


Tom --

Probably the easiest way to do this would be to open the project in the IDE, set the settings in the IDE that you want, and then save.

Even better would be to set up a specific build configuration for these settings, and use that.

The IDE uses MSBuild itself, so any settings that you make in the IDE are saved in the *.DPROJ file (or GROUPPROJ, in your case), and so when you execute the command line, the exact same settings are used as were set in the IDE. If you use a specific build configuration for this specific set of options, you can simply call that configuration on the command line and you'll get what you want.

In other, shorter words: Let the IDE do the work for you.


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

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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜