WiX-从上一个对话框设置属性

时间:2019-06-14 16:49:27

标签: wix

我从WiX看到一些奇怪的行为,这让我头疼。

业务规则:允许用户覆盖安装目录。允许用户覆盖配置文件的安装目录(将安装目录用作先前设置的默认路径)。

对话框流程如下(下面的标记):WelcomeDlg-> InstallDirDlg-> LogConfigDlg

<UI Id="MyWixUI_InstallDir">
  <UIRef Id="WixUI_InstallDir" />
  <!--Add default dialogs: BrowseDlg, DiskCostDlg, InstallDirDlg, InvalidDirDlg, LicenseAgreementDlg, WelcomeDlg, VerifyReadyDlg, etc.-->
  <!--<DialogRef Id="AppConfigDlg" />-->

  <!-- Override the next and back buttons on the WelcomeDlg and InstallDirDlg to skip the License agreement page of the installer -->
  <Publish Dialog="WelcomeDlg" Control="Next" Event="DoAction" Value="regSetINSTALLDIR" Order="1">PREVIOUSINSTALLFOLDER</Publish>
  <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">NOT Installed</Publish>

  <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="1">1</Publish>
  <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="SetLOGCONFIGDIR" Order="2">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
  <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="regSetLOGINSTALLDIR" Order="3">PREVIOUSLOGINSTALLFOLDER</Publish>
  <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="LogConfigDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>

  <Publish Dialog="LogConfigDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg"></Publish>
  <Publish Dialog="LogConfigDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg"></Publish>

关于“ InstallDirDlg”接下来,我想做一些事情。首先传递进入“ LOGCONFIG_DIR”属性的“路径” ...

<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="SetLOGCONFIGDIR" Order="2">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>

<CustomAction Id="SetLOGCONFIGDIR" Property="LOGCONFIG_DIR" Value="[TESTSAVVY_SERVICES]" />

<!--Required for InstallDirDlg-->
<Property Id="WIXUI_INSTALLDIR" Value="TESTSAVVY_SERVICES" />
<!--Required for LogConfigDlg-->
<Property Id="LOGCONFIG_DIRECTORY" Value="LOGCONFIG_DIR" />

接下来是检查LOGCONFIG_DIR的注册表值,此逻辑工作正常。...

<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="regSetLOGINSTALLDIR" Order="3">PREVIOUSLOGINSTALLFOLDER</Publish>

<CustomAction Id="regSetLOGINSTALLDIR" Property="LOGCONFIG_DIR" Value="[PREVIOUSLOGINSTALLFOLDER]" />

<Property Id="PREVIOUSLOGINSTALLFOLDER">
  <RegistrySearch Id='LOGCONFIG_DIRRegSrch' Type='raw' Root='HKLM' Key='Software\[Manufacturer]\[ProductName]' Name='LOGCONFIG_DIR' />
</Property>

最后导航到下一个对话框。因此,问题出在“发布-Event =“ DoAction” Value =“ SetLOGCONFIGDIR””上。该目录不会反映用户在InstallDirDlg中的内容,除非用户按下“ LogConfigDlg”中的“后退”按钮,然后再次在“ InstallDirDlg”中再次按下“ next”。

为什么用户第一次从“ InstallDirDlg”中按下“ next”时没有触发此操作,如上所述,用户必须返回该页面并再次按下next?任何想法将不胜感激。

当注册表项存在时,以相同的方式设置的其他操作也可以很好地工作,这是非常奇怪的。


更新

在导航到下一个对话框窗口“ LogConfigDlg”时,下面将包括日志部分。

在注册表项存在时登录('regSetLOGINSTALLDIR'),此方法有效...

Info 2898.For WixUI_Font_Title textstyle, the system created a 'Tahoma' font, in 0 character set, of 14 pixels height.
Action 13:56:36: InstallDirDlg. Dialog created
MSI (c) (18:20) [13:56:38:182]: Doing action: WixUIValidatePath
MSI (c) (18:20) [13:56:38:183]: Note: 1: 2205 2:  3: ActionText 
Action 13:56:38: WixUIValidatePath. 
Action start 13:56:38: WixUIValidatePath.
MSI (c) (18:20) [13:56:38:202]: Creating MSIHANDLE (3) of type 790542 for thread 27680
MSI (c) (18:34) [13:56:38:234]: Invoking remote custom action. DLL: C:\Users\WESLEY~1.MUR\AppData\Local\Temp\MSI23C8.tmp, Entrypoint: ValidatePath
MSI (c) (18!E4) [13:56:38:242]: Creating MSIHANDLE (4) of type 790541 for thread 13796
MSI (c) (18!E4) [13:56:38:243]: PROPERTY CHANGE: Adding WIXUI_INSTALLDIR_VALID property. Its value is '1'.
MSI (c) (18!E4) [13:56:38:243]: Closing MSIHANDLE (4) of type 790541 for thread 13796
MSI (c) (18:34) [13:56:38:244]: Closing MSIHANDLE (3) of type 790542 for thread 27680
Action ended 13:56:38: WixUIValidatePath. Return value 1.
MSI (c) (18:20) [13:56:38:246]: Doing action: regSetLOGINSTALLDIR
MSI (c) (18:20) [13:56:38:246]: Note: 1: 2205 2:  3: ActionText 
Action 13:56:38: regSetLOGINSTALLDIR. 
Action start 13:56:38: regSetLOGINSTALLDIR.
MSI (c) (18:20) [13:56:38:247]: PROPERTY CHANGE: Modifying LOGCONFIG_DIR property. Its current value is 'C:\TestSavvyService\'. Its new value: 'C:\TestSavvyService\hiwes'.
Action ended 13:56:38: regSetLOGINSTALLDIR. Return value 1.
Action 13:56:38: LogConfigDlg. Dialog created
MSI (c) (18:20) [13:56:40:356]: PROPERTY CHANGE: Modifying LOGCONFIG_DIR property. Its current value is 'C:\TestSavvyService\hiwes'. Its new value: 'C:\TestSavvyService\hiwes\'.

在注册表项不存在时进行登录。在两种情况下均应运行“ SetLOGCONFIGDIR”;但是,正如我们所看到的,不是...

Info 2898.For WixUI_Font_Title textstyle, the system created a 'Tahoma' font, in 0 character set, of 14 pixels height.
Action 13:58:51: InstallDirDlg. Dialog created
MSI (c) (2C:4C) [13:58:54:966]: PROPERTY CHANGE: Modifying TESTSAVVY_SERVICES property. Its current value is 'C:\TestSavvyService\'. Its new value: 'C:\TestSavvyService\temp\'.
MSI (c) (2C:4C) [13:58:55:092]: Note: 1: 2727 2:  
MSI (c) (2C:4C) [13:58:55:092]: Doing action: WixUIValidatePath
MSI (c) (2C:4C) [13:58:55:092]: Note: 1: 2205 2:  3: ActionText 
Action 13:58:55: WixUIValidatePath. 
Action start 13:58:55: WixUIValidatePath.
MSI (c) (2C:4C) [13:58:55:098]: Creating MSIHANDLE (3) of type 790542 for thread 27468
MSI (c) (2C:4C) [13:58:55:118]: Invoking remote custom action. DLL: C:\Users\WESLEY~1.MUR\AppData\Local\Temp\MSI3A92.tmp, Entrypoint: ValidatePath
MSI (c) (2C!04) [13:58:55:126]: Creating MSIHANDLE (4) of type 790541 for thread 16900
MSI (c) (2C!04) [13:58:55:127]: PROPERTY CHANGE: Adding WIXUI_INSTALLDIR_VALID property. Its value is '1'.
MSI (c) (2C!04) [13:58:55:127]: Closing MSIHANDLE (4) of type 790541 for thread 16900
MSI (c) (2C:4C) [13:58:55:128]: Closing MSIHANDLE (3) of type 790542 for thread 27468
Action ended 13:58:55: WixUIValidatePath. Return value 1.
Action 13:58:55: LogConfigDlg. Dialog created
Action 13:58:58: CancelDlg. Dialog created

1 个答案:

答案 0 :(得分:0)

我已解决此问题。下面是现在正确的日志文件中的输出。

Info 2898.For WixUI_Font_Title textstyle, the system created a 'Tahoma' font, in 0 character set, of 14 pixels height.
Action 14:11:02: InstallDirDlg. Dialog created
MSI (c) (F4:F4) [14:11:08:732]: PROPERTY CHANGE: Modifying TESTSAVVY_SERVICES property. Its current value is 'C:\TestSavvyService\'. Its new value: 'C:\TestSavvyService\sad\'.
MSI (c) (F4:F4) [14:11:08:863]: Note: 1: 2727 2:  
MSI (c) (F4:F4) [14:11:08:863]: Doing action: WixUIValidatePath
MSI (c) (F4:F4) [14:11:08:863]: Note: 1: 2205 2:  3: ActionText 
Action 14:11:08: WixUIValidatePath. 
Action start 14:11:08: WixUIValidatePath.
MSI (c) (F4:F4) [14:11:08:871]: Creating MSIHANDLE (3) of type 790542 for thread 12020
MSI (c) (F4:F8) [14:11:08:887]: Invoking remote custom action. DLL: C:\Users\WESLEY~1.MUR\AppData\Local\Temp\MSI6D07.tmp, Entrypoint: ValidatePath
MSI (c) (F4!68) [14:11:08:895]: Creating MSIHANDLE (4) of type 790541 for thread 30056
MSI (c) (F4!68) [14:11:08:896]: PROPERTY CHANGE: Adding WIXUI_INSTALLDIR_VALID property. Its value is '1'.
MSI (c) (F4!68) [14:11:08:896]: Closing MSIHANDLE (4) of type 790541 for thread 30056
MSI (c) (F4:F8) [14:11:08:896]: Closing MSIHANDLE (3) of type 790542 for thread 12020
Action ended 14:11:08: WixUIValidatePath. Return value 1.
MSI (c) (F4:F4) [14:11:08:899]: Doing action: SetLOGCONFIGDIR
MSI (c) (F4:F4) [14:11:08:899]: Note: 1: 2205 2:  3: ActionText 
Action 14:11:08: SetLOGCONFIGDIR. 
Action start 14:11:08: SetLOGCONFIGDIR.
MSI (c) (F4:F4) [14:11:08:899]: PROPERTY CHANGE: Modifying LOGCONFIG_DIR property. Its current value is 'C:\TestSavvyService\'. Its new value: 'C:\TestSavvyService\sad\'.
Action ended 14:11:08: SetLOGCONFIGDIR. Return value 1.
MSI (c) (F4:F4) [14:11:08:899]: Doing action: regSetLOGINSTALLDIR
MSI (c) (F4:F4) [14:11:08:899]: Note: 1: 2205 2:  3: ActionText 
Action 14:11:08: regSetLOGINSTALLDIR. 
Action start 14:11:08: regSetLOGINSTALLDIR.
MSI (c) (F4:F4) [14:11:08:899]: PROPERTY CHANGE: Modifying LOGCONFIG_DIR property. Its current value is 'C:\TestSavvyService\sad\'. Its new value: 'C:\TestSavvy\hiwes'.
Action ended 14:11:08: regSetLOGINSTALLDIR. Return value 1.
Action 14:11:08: LogConfigDlg. Dialog created

如您所见,当注册表存在时,两个动作都被触发。注册表项的覆盖会正确发生。

问题是由“订单”属性引起的。我很确定我的问题是由使用WiX托管对话框窗口(InstallDirDlg)引起的。该修复程序最终将“ SetLOGCONFIGDIR”事件的“ Order”属性设置为“ 3”,以下是“ next”的完整链的示例...

<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="SetLOGCONFIGDIR" Order="3">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="regSetLOGINSTALLDIR" Order="3">PREVIOUSLOGINSTALLFOLDER</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="LogConfigDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>