Dialog sequence based on Registry Search - wix

What I'm trying to do is if a certain registry value is not found on the machine, a custom dialog will be shown to them where they can choose the value that they want to add. The problem is when they select that value and click Next, then click Back, since the property relating to that registry is already filled, the custom dialog will not be shown anymore unless they re-run the installer. I hope I'm clear enough, here're the snippets of the code.
<Property Id="REG_VAL" Value="NoValueFound">
<RegistrySearch ... />
</Property>
<Component ...>
<RegistryValue Value="[REG_VAL]".../>
</Component>
<UI...>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="ChooseValueDlg">
<![CDATA[(REG_VAL="NoValueFound")]]>
</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">
<![CDATA[(REG_VAL<>"NoValueFound")]]>
</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ChooseValueDlg">
<![CDATA[(REG_VAL="NoValueFound")]]>
</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">
<![CDATA[(REG_VAL<>"NoValueFound")]]>
</Publish>
</UI>
<UI>
<Dialog Id="ChooseValueDlg" ...>
<Control Id="rdoBtnGrp" Type="RadioButtonGroup" Property="REG_VAL" ...>
<RadioButtonGroup Property="REG_VAL">
<RadioButton Value="NoValueFound" .../>
<RadioButton Value="Value1" .../>
<RadioButton Value="Value2" .../>
</RadioButtonGroup>
</Control>
</Dialog>
</UI>

You need to save the results of the registry search into two properties and bind one of them to the UI for editing by the user and one used as conditions for the mutually exclusive control events. This way if you start off with both null the dialog gets displayed and then when the user enters data into one the other is still null and the dialog will still be displayed.
BTW I like to ditch the unneeded CDATA and use PROPERTY and Not PROPERTY. I think it's easier to read.

Related

Set property in custom dialog for conditional feature

I have a property called SELECTEDFEATURESET with a default value of 'none'. In a custom dialog I'm trying to set this property, according to which button the user pressed. At the end I use the property to decide if certain components shall be installed or not.
Propery defined in the main installer file (Product.wxs):
<Property Id='SELECTEDFEATURESET' Value='none' />
Set the property in the dialog:
<Control Id="InternalFeatureButton" Type="PushButton" Text="FeatureSetA">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetA">1</Publish>
</Control>
<Control Id="ProductionFeatureButton" Type="PushButton" Text="FeatureSetB">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetB">1</Publish>
</Control>
<Control Id="DemoFeatureButton" Type="PushButton" Text="FeatureSetC">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetC">1</Publish>
</Control>
Decide whether the feature shall be installed or not:
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentA' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetA"]]></Condition>
</Feature>
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentB' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetB"]]></Condition>
</Feature>
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentC' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetC"]]></Condition>
</Feature>
When I run the installer and press the FeatureSetA button, no optional component is installed. When I initialize the SELECTEDFEATURESET property with 'FeatureSetA', then the ComponentA is installed (same for A, B and C).
Why is the value of SELECTEDFEATURESET 'none' instead of 'FeatureSetA' / 'FeatureSetB' / 'FeatureSetC' at the time of the feature condition evaluation?
How do I fix it?
I fixed it my moving the condition from the feature to the component.

WIX UI Property Change Not Publishing

I have a edit control in WIXUI that's bound to a property
<Property Id="WIXUI_FILESHAREDIR">FILESHAREDIR</Property>
and the UI
<Control Id="FileSharePathGroup" Type="GroupBox" Height="89" Width="352" X="8" Y="96" Text="File Share"/>
<Control Id="FileSharePathLabel" Type="Text" X="20" Y="114" Width="69" Height="13" Text="File Share Path"/>
<Control Id="FileSharePathEdit" Type="PathEdit" X="20" Y="126" Width="250" Height="16" Property="WIXUI_FILESHAREDIR" Indirect="yes" />
<Control Id="FileSharePathBrowse" Type="PushButton" X="280" Y="125" Width="56" Height="17" Text="Browse"/>
and the following Publish statements:
<Publish Dialog="ConfigurationDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Dialog="ConfigurationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="ConfigurationDlg" Control="FileSharePathBrowse" Property="_BrowseProperty" Value="[WIXUI_FILESHAREDIR]" Order="1">1</Publish>
<Publish Dialog="ConfigurationDlg" Control="FileSharePathBrowse" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
When I use the browse button the FILESHAREDIR property ends up getting updated correctly. When I type into the text editor manually and hit Next, it doesn't and the FILESHAREDIR retains the incorrect default value at install time.
Am I missing a Publish statement?
You need to use the Property#Secure attribute to list the public property in the SecureCustomProperties property.

New dialog in WiX, clicking Back skips the dialog

I'm newbie in WiX and trying to customize dialog queue by adding the new one. The new dialog's name is ServerChoice and the flow is:
SetupTypeDlg <-> Full or Typical <-> ServerChoice <-> VerifyReadyDlg
or
SetupTypeDlg <-> Custom <-> CustomizeDlg <-> ServerChoice <-> VerifyReadyDlg
The only problem is in the first case at VerifyReadyDlg. 'Back' takes me to SetupTypeDlg and skips ServerChoice although in the second flow it works as required.
Source:
<UI>
<DialogRef Id="ServerChoice" />
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="ServerChoice">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="ServerChoice">1</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ServerChoice">1</Publish>
<Publish Dialog="ServerChoice" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServerChoice">1</Publish>
<Publish Dialog="ServerChoice" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="ServerChoice" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
<Publish Dialog="ServerChoice" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="ServerChoice" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
</UI>
Some help for a newbie? :)
What type of UI are you referencing (Mondo?). This information is not present in your piece of code. I think daddyman's comment is right, you probably have multiple events for that Back button, since Mondo itself hooks its own 'handlers' on this button-click event.
I have created a custom UI dialog flow recently and my approach was not referencing WiXUI_Mondo at all. Instead of it, I created my own new UI based on Mondo source code (you have to check WiX sources). At the end I have this code (irrelevant code parts have been removed) and it works fine.
<Fragment>
<!-- this is based on the WixUI_Mondo dialog set -->
<UI Id="WixUI_MyNewUI">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="Mondo" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">1</Publish>
<!-- we do not use the SetupTypeDlg which allows user to choose either Typical, Complete or Custom installation; this ensures InstallCustom schema is run -->
<Publish Dialog="WelcomeDlg" Control="Next" Property="WixUI_InstallMode" Value="InstallCustom" Order="2">1</Publish>
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="MyDlg1">1</Publish>
<Publish Dialog="MyDlg1" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="1">MY_CONDITION_PROPERTY = 0</Publish>
<Publish Dialog="MyDlg1" Control="Next" Event="NewDialog" Value="MyDlg2" Order="2">MY_CONDITION_PROPERTY = 1</Publish>
<Publish Dialog="MyDlg2" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="1" />
<Publish Dialog="MyDlg2" Control="Back" Event="NewDialog" Value="MyDlg1">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MyDlg1" Order="1">WixUI_InstallMode = "InstallCustom" and MY_CONDITION_PROPERTY = 0</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MyDlg2" Order="2">WixUI_InstallMode = "InstallCustom" and MY_CONDITION_PROPERTY = 1</Publish>
</UI>
<UIRef Id="WixUI_Common" />
<UIRef Id="WixUI_ErrorProgressText" />
</Fragment>
I think from your fragment that you are trying to do it in a just UI section and I don't believe that is possible. Take a look here http://neilsleightholm.blogspot.com/2008/08/customised-uis-for-wix.html I think it should help.

Based on CheckBox value show the WIX Dialog

I have instakllation i have to show the Dialog based on the checkbox value. I have set the checkbox property as true initially.
<Property Id="CHECKBOX_1_PROP" Value="TRUE" />
And show the dialog based on the check box values. If it is true i have to show the Newdoalog_1 if it is false i have to show the Setup dialog
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="[ButtonText_Next]" TabSkip="no" Default="yes">
<Publish Event="SetTargetPath" Value="APPDIR">INSTALL</Publish>
<Publish Event="NewDialog" Value="NewDialog_1">INSTALL AND CHECKBOX_1_PROP="TRUE"</Publish>
<Publish Event="NewDialog" Value="SetupTypeDlg">INSTALL</Publish>
</Control>
<Control Id="CheckBox_1" Type="CheckBox" X="25" Y="164" Width="211" Height="26" Property="CHECKBOX_1_PROP" Text="Do you want to install the Samples" CheckBoxValue="CheckBox" TabSkip="no" Hidden="yes">
<Condition Action="show">INSTALL</Condition>
</Control>
My Problem is always show the Setup Dialog that is False condition.
Pls help on this.
I'm guessing your checkbox isn't setting the string literal "TRUE", check-boxes completely delete the property when unchecked. Setting that property to any value ("0", "true", "false", "-1") would cause it to be checked. So ignore the value, just check if the property exists or not.
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog" Value="CustomDlg1">PROP1</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog" Value="CustomDlg2">Not PROP1</Publish>
To get the SetupTypeDlg to only show when CHECKBOX_1_PROP <> "TRUE" the code should look something like this:
<Publish Event="NewDialog" Value="SetupTypeDlg"><![CDATA[INSTALL AND CHECKBOX_1_PROP<>"TRUE"]]></Publish>

How to build a minimal WiX installer UI without a license page?

I would like to use the WixUI_Minimal installer, but I don't want the license page. How can I do this?
I would simply use one of the already created WiX UI and override the sequence (make it higher so that it will override the previous setting):
<Product>
...
<UI>
<UIRef Id="WixUI_InstallDir" />
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
...
</Product>
The key is to make a custom UI and hook up different pages. See the page on WixWiki
You want to grab the WixUI minimal code, and modify it a bit. Instead of the WelcomeEulaDlg welcome dialog, you want to use the WelcomeDlg. Adjust the references, and wire up the Next button on the WelcomeDlg to the next dialog in the stack, which would be the PrepareDlg.
Full Code:
<UI Id="WixUI_Minimal">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="Minimal" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<!-- This is the welcome dialog you specified-->
<DialogRef Id="WelcomeDlg" />
<!-- Hook the new welcome dialog to the next one in the stack-->
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="PrepareDlg">1</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<UIRef Id="WixUI_Common" />
The low-tech way to get around this is simply to set the property LicenseAccepted to 1 and put some useful readme type information into the license box. This means the user doesn't have to click the box and you don't have to worry about creating an additional dialog :)
Example:
<Property Id="LicenseAccepted" Value="1"/>
See the answer to a related question, WiX script with only Welcome and Completed screens, for the simplest minimal UI:
WelcomeDlg
Installation progress
Exit Dialog
#Ran Davidovitz 's answer is very good
but be carefully:
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
it must have Order="2",or it can't work.