Markus Ott
Markus Ott

Reputation: 101

How do I check values in WiX?

I've got the following in WiX:

A dialog offers two checkboxes to install software for Excel 2007 and / or Excel 2010.

<Control Type="CheckBox" Id="Excel2007" Width="88" Height="17" X="22" Y="120" Text="Excel 2007" Property="INSTALLEXCEL2007_2010" CheckBoxValue="1" />

<Control Type="CheckBox" Id="Excel2010" Width="88" Height="17" X="22" Y="120" Text="Excel 2010" Property="INSTALLEXCEL2010" CheckBoxValue="1" />

I want to evaluate which checkbox has been set by the user to check if the PIAs (tools for Excel 2007 / 2010) have been installed. If not, the installation should be stoppend with a message.

The current problem is:

I can't check for those two values as a launch condition, because I don't know the user's decision. I thought that I might use a condition in the dialog where the checkboxes are, like this:

<Publish Dialog="ExcelConfigDlg" Control="ExcelConfigDlg_Proceed" Event="NewDialog" Value="InstallDirDlg"><![CDATA[INSTALLEXCEL2007>="1"]]></Publish>

However, this doesn't work. When clicking on the button, the installation routine proceeds.

How can I fix this problem?

Upvotes: 0

Views: 2827

Answers (2)

Markus Ott
Markus Ott

Reputation: 101

I wanted to validate a checkbox value and, depending on that, check some more values (received via RegistrySearch). Up to now, I ended up with the following (which is working so far):

<Publish Dialog="ExcelChooserDlg" Control="ExcelChooser_Weiter" Event="NewDialog" Value="FileConfigDlg" Order="1"><![CDATA[INSTALLEXCEL2003="1" OR INSTALLEXCEL2007="1" OR INSTALLEXCEL2010="1"]]></Publish>
        <Publish Dialog="ExcelChooserDlg" Control="ExcelChooser_Weiter" Event="SpawnDialog" Value="CancelDlg" Order="2"><![CDATA[INSTALLEXCEL2003<>"1" AND INSTALLEXCEL2007<>"1" AND INSTALLEXCEL2010<>"1"]]></Publish>
        <Publish Dialog="ExcelChooserDlg" Control="ExcelChooser_Weiter" Event="SpawnDialog" Value="CancelDlg" Order="3"><![CDATA[INSTALLEXCEL2007="1" AND OFFICERUNTIME<"10.0.31007"]]></Publish>
        <Publish Dialog="ExcelChooserDlg" Control="ExcelChooser_Weiter" Event="SpawnDialog" Value="CancelDlg" Order="4"><![CDATA[INSTALLEXCEL2007="1" AND OFFICERUNTIME<"10.0.31007" AND OFFICE_2007_PIA<>"Microsoft Office 2007 Primary Interop Assemblies"]]></Publish>
        <Publish Dialog="ExcelChooserDlg" Control="ExcelChooser_Weiter" Event="SpawnDialog" Value="CancelDlg" Order="5"><![CDATA[INSTALLEXCEL2010="1" AND OFFICERUNTIME<"10.0.31007" AND OFFICE_2010_PIA<>"Microsoft Office 2010 Primary Interop Assemblies"]]></Publish>

I`m not sure if this is best best solution, but as I stated, it´s working for me so far.

Upvotes: 0

Natalie Carr
Natalie Carr

Reputation: 3807

Answering your first and second question:

<Publish Dialog="ExcelConfigDlg" Control="ExcelConfigDlg_Proceed" Event="NewDialog" Value="InstallDirDlg"><![CDATA[INSTALLEXCEL2007_2010="1"]]></Publish>

I think you want to raise say a warning dialog if they user does not select any of the check boxes. This is an example of one of my warning dialogs:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
 <UI>
  <Dialog Id="WarningDlg" Width="260" Height="85" Title="!(loc.Title)">
    <Control Id="Ok" Type="PushButton" X="112" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="Ok">
      <Publish Event="EndDialog" Value="Return">1</Publish>
    </Control>
    <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30" NoPrefix="yes" Text="!(loc.IntegerOnlyDlgDecription)" />
    <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" FixedSize="yes" IconSize="32" Text="Exclamation" />
  </Dialog>
</UI>
</Fragment>

and use the following:

<Publish Dialog="ExcelConfigDlg" Control="ExcelConfigDlg_Proceed" Event="SpawnDialog" Value="WarningDlg"><![CDATA[(INSTALLEXCEL2007_2010<>"1") AND (INSTALLEXCEL2010<>"1")]]></Publish>

Upvotes: 1

Related Questions