lundi 18 novembre 2019

WIX pass checkbox value to custom action

The case is, I want to have a checkbox in a dialog. If the checkbox is checked I want to create a file and do some other stuff.

I have a custom action which should using the value of the checkbox-property.

Now I try to pass the checkbox value to my CA-Method but it never receives a value, the variable is present but always empty. I asume the checkbox variable itself is not present at this point, because session.CustomActionData.ToString() shows:

INSTALLFOLDER=C:\Program Files (x86)\WixTesterSetup\;CHECKBOXProperty=

My Dialog is:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <UI Id="UserRegDialogUI">
      <Property Id="Proceed">proceedbtn</Property>
      <Dialog Id="UserRegDialog" Width="400" Height="300" Title="Atled Service Konfiguration">
        <Control Id="headerText" Type="Text" X="65" Y="10" Width="350" Height="40" Transparent="yes" Text="Something to Check" />
        <Control Id="checkboxLabel" Type="Text" X="58" Y="150" Height="14" Width="141" Transparent="yes" Text="Checkbox Text" />
        <Control Id="checkbox" Type="CheckBox" X="60" Y="165" Height="17" Width="120" Property="CHECKBOXProperty" CheckBoxValue="true" />
        <Control Id="proceedButton" Type="PushButton" Text="Weiter" Height="20" Width="43" X="349" Y="266">
          <Publish Event="EndDialog" Value="Return">1</Publish>
        </Control>
        <Control Id="cancelButton" Type="PushButton" Text="Beenden" Height="22" Width="50" X="293" Y="266" Cancel="yes">
          <Publish Event="EndDialog" Value="Exit" />
        </Control>
      </Dialog>
    </UI>
    <InstallUISequence>
      <Show Dialog="UserRegDialog" Before="ExecuteAction" />
    </InstallUISequence>
  </Fragment>
</Wix>

And Product.wsx contains:

<Binary Id="CustomActionBinary" SourceFile="$(var.RegistrationInfoCustomAction.TargetDir)$(var.RegistrationInfoCustomAction.TargetName).CA.dll"/>
    <CustomAction Id="RegistrationInfoCustomAction" BinaryKey="CustomActionBinary" DllEntry="SaveUserInfo" Execute="deferred" Impersonate="no" />
    <CustomAction Id="CustomAction51" Property="RegistrationInfoCustomAction" Value="INSTALLFOLDER=[INSTALLFOLDER];CHECKBOXProperty=[CHECKBOXProperty]" />

    <InstallExecuteSequence>
      <Custom Action="CustomAction51" Before='InstallFinalize' />
      <Custom Action='RegistrationInfoCustomAction' After='CustomAction51'>NOT Installed</Custom>
    </InstallExecuteSequence>

I tried to initialize set the property:

<Property Id="CHECKBOXProperty" Value="true" />

In that case it´s always true even if I uncheck the box. I tried empty value (compiler says the property will be ignored)

May someone tell me a solution?




Aucun commentaire:

Enregistrer un commentaire