Search code examples
propertieswixwindows-installercustom-action

property values get corrupt


I pass property values like this:

property1=value1;property2=value2

but sometimes values contain ';' symbols, which causes WiX to deserialize the property string incorrectly. I've tried enquoting values with double quotes

property1="value1";property2="value2"

but that didn't help. So how can I deal with this?


Solution

  • Replying to request in comments. To double semi-colons in a property value, you can use JScript CA:

    <CustomAction Id="DoubleSemiColons" Script="jscript">
        <![CDATA[
    
        var s = Session.Property("property2");
        var re = /;/g;
        var r = s.replace(re, ";;");
    
        Session.Property("property2") = r;
    
        ]]>
    </CustomAction>