Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid proceeding to the next dialog with a condition in a WiX installer

Does anyone know if/how I can stop a WiX-based MSI installer from proceeding to the next dialog when a certain condition is met? I have the following code:

<Dialog Id="SelectIISApplicationPoolUserDialog" Width="370" Height="270" Title="$(var.ApplicationPoolUserDialogTitle)">
  <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
    <Publish Property="APPLICATIONPOOLUSER" Value="{}">WEBSITE_APPLICATIONPOOLUSERTYPE = "local"</Publish>
    <Publish Property="APPLICATIONPOOLUSER" Value="1">WEBSITE_APPLICATIONPOOLUSERTYPE = "domain"</Publish>
    <Publish Event="DoAction" Value="CheckPortNumber">1</Publish>
  </Control>

CheckPortNumber refers to this:

<Binary Id="IISCA" SourceFile="binaries/MyCustomActions.IIS.CA.dll" />
<CustomAction Id="CheckPortNumber" 
              BinaryKey="IISCA" 
              DllEntry="IsFreePort" 
              Execute="immediate" />

Also, somewhere else, we have this declare:

<Publish Dialog="SelectIISApplicationPoolUserDialog" 
         Control="Next" 
         Event="NewDialog" 
         Value="SetSqlServerConnectionDialog">ISPORTFREE</Publish>

When I run the installer and get to the dialog to select the application pool user, I click next. The custom action then checks the portnumber and sets the ISPORTFREE variable. However, the next dialog isn't shown, regardless of the result of ISPORTFREE. But when I click Next a second time, the next dialog is shown.

So what I want is: when I click next and the entered portnumber is in use, I get a warning and don't proceed to the next dialog. If it isn't in use, I proceed to the next dialog.

like image 450
Peter Avatar asked Nov 17 '09 09:11

Peter


1 Answers

You'll need to set Publish/@Order so that everything is evaluated in the correct order.

Something like the following should probably work:

<Publish Dialog="MyDlg" Control="Next" Event="DoAction" 
         Value="SomeAction" Order="1">1</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="SpawnDialog" 
         Value="MyWarningDlg" Order="2">Not CONDITION</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog" 
         Value="MyOtherDlg" Order="3">CONDITION</Publish>
like image 58
saschabeaumont Avatar answered Nov 18 '22 04:11

saschabeaumont