views:

180

answers:

1

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.

+2  A: 

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>
sascha
Thanks. It worked, but I also had to check differently: ISPORTFREE = "False", because in a Custom Action you have to insert strings into the session object: session["ISPORTFREE"] = false.ToString();
Peter