简体   繁体   中英

WIX The properties modified in the custom action are not correct in the exit dialog

I need to determine if the user has installed SQL during the installation phase, and if the user is not installed, the check box for installing SQL is displayed in the exit dialog box. I defined a variable called IS_INSTALL_SQL with an initial value of 0. In the custom action, I will determine whether the user has installed SQL based on the registry, and if not installed, the IS_INSTALL_SQL is set to 1. According to the log, IS_INSTALL_SQL is set to 1, but in the exit dialog box, the value is still 0 and the check box is not displayed.

The following is the code

[product.wxs]

<Property Id="IS_INSTALL_SQL" Value="0"/>

<Binary Id="myCustomActionsDLL" SourceFile= "$(var.CustomAction1.TargetDir)CustomAction1.CA.dll" />

<CustomAction Id="checkSQLInstallAndVersion" BinaryKey="myCustomActionsDLL" DllEntry="checkSQLInstallAndVersionAction"  Execute="immediate" Return="check"/>


<InstallExecuteSequence>
  <Custom Action="checkSQLInstallAndVersion" Before="InstallValidate">NOT Installed</Custom>
</InstallExecuteSequence>

[ExitDialog.wxs]

<Control Id="InstallSQLCheckBox" 
         Type="CheckBox" 
         X="135" 
         Y="170" 
         Width="220" 
         Height="14" 
         Hidden="yes" 
         Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX_SQL" 
         CheckBoxValue="1" 
         Text="[WIXUI_EXITDIALOGINSTALLSQLTEXT]" >

    <Condition Action="show">
      <![CDATA[IS_INSTALL_SQL = "1" AND NOT Installed]]>
    </Condition>
</Control>

The following is a log snippet.

Line 86: MyLog:The SQL version is below the minimum version requirement and enters the installation SQL step.

Line 87: MyLog:#IS_INSTALL_SQL#:0

Line 88: MyLog:Set Property Value

Line 89: MyLog:#IS_INSTALL_SQL#:1

Line 187: Property(S): IS_INSTALL_SQL = 1

Line 317: Property(C): IS_INSTALL_SQL = 0

You only schedule the CA during InstallExecuteSequence which happens after the UI phase. Schedule it early in both, including InstallUISequence and sequence it before AppSearch , then define the CustomAction @Execute="firstSequence" for example so it only runs once and sets the value appropriately. While you have it defined as public (all upper case including underscores), ensure that doesn't change otherwise its value is reset to its default of 0 in your case when the client phase ends and the server phase starts.

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