tags:

views:

120

answers:

2

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 what I need, but hasn't thus far.

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

+7  A: 

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.

Nick Hodges
Does not always work when doing automated builds that need to do something different than the IDE. We use FinalBuilder to handle these situations.
Robert Love
See http://stackoverflow.com/questions/2373991/what-are-the-msbuild-project-level-properties-for-delphi for more properties you can set
Lars Truijens
Robert -- that is what different Build Configurations are for. ;-) You can do all your Build Configuration management in the IDE, and then get FinalBuilder (a terrific tool) to do the different builds based on configurations.
Nick Hodges
+3  A: 

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.

Ken White
Exactly what I was looking for, Ken.
Tom1952