Bogdan Verbenets
Bogdan Verbenets

Reputation: 26936

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?

Upvotes: 0

Views: 161

Answers (2)

Alexey Ivanov
Alexey Ivanov

Reputation: 11838

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>

Upvotes: 1

Christopher Painter
Christopher Painter

Reputation: 55571

I thought we just saw this question the other day ( short answer is escape it with ;; )

For a more detailed discussion, if you want to understand how to use Type 51 custom actions to set properties to be deserialized by a DTF custom action, write a little console app like this

var cad = new CustomActionData();
cad.Add("property1","myvalue");
cad.Add("property2","my;value");
Console.WriteLine(cad.ToString());
Console.Read();

The result will be:

property1=myvalue;property2=my;;value

This should help you know how to format every scenario possible. However, eventually you might findyourself in a situation where a Type 51 CA isn't enough. In that case you'd write an immeadiate CA to build up your CustomActionData collection and then use the Session.DoAction method to schedule your deferred CA passing the CustomActionData through to it.

Upvotes: 3

Related Questions