How to pass a parameter to a candle on the command line and let it overwrite the value in the target .wxs

I am working on an MSBUILD script to dynamically inject a number of parameters into a wix project for multiple assemblies, and I understand that I can use the -d switch in the candles to provide additional parameters.

However, I get several warnings similar to “The variable“ xxx ”with the value“ yyy ”was previously declared with the value“ zzz. ”This is understandable as in .wxs. I already have these values ​​defined for the default build , the assembly will continue to use values ​​from .wxs after warnings.

So the question is ... can this make the candle overwrite these parameters that are already in .wxs ..

Thanks in advance.

+5
source share
1 answer

Preprocessor variables can only be defined once, so you need something like:

<?ifndef Variable ?>
  <?define Variable="default" ?>
<?endif?>

to protect against overriding. This is the same as with the C / C ++ preprocessor, with which, after modeling, the WiX toolkit was created.

+3
source

All Articles