1

I'm seeing some odd behavior from WiX which is leaving me with a headache.

Business Rule: Allow user to override install directory. Allow user to override configuration file installation directory (use install directory as default path set prior).

The Dialog flow is as follows (markup below): 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>

On 'InstallDirDlg' Next I want to do a few things. First of which is pass the 'path' entered into the 'LOGCONFIG_DIR' property...

<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" />

Next is check for a registry value for the LOGCONFIG_DIR, this logic works perfectly....

<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>

And lastly navigate to the next dialog window. So the problem is with 'Publish - Event="DoAction" Value="SetLOGCONFIGDIR"'. The directory doesn't reflect what the user put in the InstallDirDlg unless the user presses the 'back' button in the 'LogConfigDlg' and then presses 'next' for a second time on 'InstallDirDlg'.

Why isn't this action being fired the first time the user pressed 'next' from the 'InstallDirDlg', as stated above the user has to go back to that page and press next again? Any ideas would be greatly appreciated.

It's doubly odd that the other action, which is set up pretty much the same way, works just fine when a registry key exists.


UPDATE

Below I'm including the log section when navigating to the next dialog window 'LogConfigDlg'.

Log for when registry key exists ('regSetLOGINSTALLDIR'), this works...

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\'.

Log for when registry key does not exist. 'SetLOGCONFIGDIR' should run in both cases; however, as we can see it's not...

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
spyder1329
  • 656
  • 5
  • 15

1 Answers1

1

I've fixed this issue. Below is the, now correct, output in the log file.

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

As you can see both actions are being triggered when the registry exists. And the override of the registry item happens correctly.

The problem was created by the 'Order' property. I'm pretty sure my issues are being caused by me using a WiX managed dialog window (InstallDirDlg). The fix ended up being setting the 'Order' property for the 'SetLOGCONFIGDIR' event to '3', example below of the complete chain for '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>
spyder1329
  • 656
  • 5
  • 15