Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

msbuild

wix

I'm working on a MSBUILD script to dynamically inject a number of parameters to a wix project for several builds, and I understand I can use -d switch in candle to supply additional params.

However I'm getting several warnings similar to "The variable 'xxx' with value 'yyy' was previously declared with value 'zzz'", This is understandable as in the .wxs I already have these values defined for a default build, the build will then carry on using the values from .wxs after the warnings.

So the question is..is it possbile to force candle to overwrite these parameters which are already in .wxs..

Thanks in advance.

like image 847
Godsent Avatar asked Jul 27 '12 11:07

Godsent


1 Answers

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

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

to protect against redefinition. This is the same as with the C/C++ preprocessor that the WiX toolset was modeled after.

like image 109
Rob Mensching Avatar answered Oct 15 '22 13:10

Rob Mensching