The way I approach this is to define several build configurations, and then select the appropriate /p:config=XXX
at the time of build. The job works well in the IDE because you can simply double-click the assembly configuration in the project manager to activate it.
I personally use the inheritance of assembly configurations when I do this so as not to repeat myself. For example, I have an assembly configuration called Debug DCUs
that inherits from the Debug
configuration and simply changes the Debug DCUs
parameter to True
.
To explain what I mean, here is what the assembly configuration tree looks like in my project:
Debug DCUs
are configured using this option:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <DCC_DebugDCUs>true</DCC_DebugDCUs> </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ām sure that you can do this using /p:DCC_Define=XXX
, but I think that using the build configuration is cleaner so that you can be sure that what you get is the IDE is the same as what you get from the built command line.
I would not recommend a single approach to the token list. These approaches look extremely fragile to me.
source share