简体   繁体   中英

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM