How to modify/replace option set file when building from command line?
Posted
by
Heinrich Ulbricht
on Stack Overflow
See other posts from Stack Overflow
or by Heinrich Ulbricht
Published on 2011-11-29T17:36:42Z
Indexed on
2011/11/29
17:50 UTC
Read the original article
Hit count: 332
I build packages from a batch file using commands like:
msbuild ..\lib\Package.dproj /target:Build /p:config=%1
The packages' settings are dependent on an option set:
<Import Project="..\optionsets\COND_Defined.optset" Condition="'$(Base)'!='' And Exists('..\optionsets\COND_Defined.optset')"/>
This option set defines a conditional symbol many of my packages depend on. The file looks like this:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DCC_Define>CONDITION;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType>OptionSet</Borland.ProjectType>
<BorlandProject>
<Delphi.Personality/>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
</Project>
Now I need two builds: one with the condition defined and one without. My attack vector would be the option set file. I have some ideas on what to do:
- write a program which modifies the option set file, run this before batch build
- fiddle with the project files and modify the option set path to contain an environment variable, then have different option sets in different locations
But before starting to reinvent the wheel I'd like to ask how you would tackle this task? Maybe there are already means meant to support such a case (like certain command line switches, things I could configure in Delphi or batch file magic).
© Stack Overflow or respective owner