I\'m currently integrating my Wix projects in MSBuild. It is necessary for me to pass multiple values to the Wix project. One value will work (ProductVersion in the sample b
The problem lies in passing the name-value pairs to the MSBuild task, and then having MSBuild parse them properly so they can be passed to the Candle task. It seems that MSBuild can handle a list of simple names, or a single name-value pair, but not a list of pairs.
My solution is to escape the list when it's passed into the MSBuild task, and unescape it again when it goes to the Candle task.
In your MSBuild file, define the pairs in a property like this:
One=1;
Two=2;
Three=3;
When you call the MSBuild task, escape the property (requires MSBuild 4):
The unescaping has to be done in the wixproj file, but there's no need to edit the file by hand. Just open the project's properties, go to the Build tab, and where it says "Define preprocessor variables", put:
$([MSBuild]::Unescape($(WixValues)))
This works even if there are other variables already in that box; just add this to the list along with a semicolon.
You'll see in the MSBuild log that the candle.exe tool receives the arguments correctly:
candle.exe -dOne=1 -dTwo=2 -dThree=3 -dConfiguration=Release...