Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't pass properties to WiX custom action

I've read How do I pass msiexec properties to a WiX C# custom action? , but that didn't answer my question, or maybe I just don't see what I am doing wrong. My install package fails to install, and the logs say that my property wasn't found in the custom actions collection. My code is:

    <CustomAction Id="SetCustomActionDataValue" Return="check" Property="Itp.Configurator.WixCustomAction" Value="G=G2" />
    <CustomAction Id="CreateDatabase" BinaryKey="Binary1" DllEntry="CreateDatabase" Execute="deferred" Return="check" />
    <InstallExecuteSequence>
        <Custom Action='SetCustomActionDataValue'  After="InstallFiles"/>
        <Custom Action='CreateDatabase'  After="SetCustomActionDataValue">
            NOT Installed AND NOT PATCH
        </Custom>
    </InstallExecuteSequence>

And code inside the custom action is:

string Property1 = session.CustomActionData["G"];
like image 513
Bogdan Verbenets Avatar asked Apr 18 '11 10:04

Bogdan Verbenets


1 Answers

The name of the property in your first element must be exactly the same as the name of the deferred custom action you'd like to pass the value to. So, if the deferred action is CreateDatabase, then the first element should look like this:

<CustomAction Id="SetCustomActionDataValue" Return="check" Property="CreateDatabase" Value="G=G2" />
like image 113
Yan Sklyarenko Avatar answered Oct 23 '22 11:10

Yan Sklyarenko