Set sequence of dialogs and customization in WIX - wix

I am writing an Installer in Wix and want the following sequence where the order of dialogs and custom actions are mixed. There are two scenarios.
First scenario: the user installs the software for trial:
Welcome (dialog)
License agreement (dialog)
Register installation on my website (custom action), the web server responds new user (trial period).
--
--
Finish installation (dialog)
Second scenario: the user has already used the software for the trial period and must type a license code for full installation. New steps are marked with an *.
Welcome (dialog)
License agreement (dialog)
Register installation on my website (custom action), * the web server responds old user (license needed).
*Type License key (dialog)
*Verify License Key at web server (custom action).
Finish installation (dialog)
The two scenarios differ in how the web server responds in step 3. It's important that step 3 comes after acceptance of license terms.
I have no problem running the dialogs, and I can run the custom actions. But I can't figure out how to mix the sequence of them. I have been using Nick Ramirez WIX Cookbook, but I can't see that it covers the topic.
Question 1: How do I mix the sequence of dialogs and custom action?
Question 2: How can the result of a Custom action (step 3) be used to chose between two different dialogs (step 4 or 6)?

After some trial and error I found this solution to the problem:
<Property Id="INSTALL_WEB_RESPONSE" Value="NO" />
<UI Id="UIFlow">
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="DoAction" Value="CA_Licens">LicenseAccepted = "1"AND INSTALL_WEB_RESPONSE = "NO"</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="MyCustomDlg">LicenseAccepted = "1" AND INSTALL_WEB_RESPONSE = "OVERSKREDET"</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">LicenseAccepted = "1" AND INSTALL_WEB_RESPONSE = "GEMT"</Publish>
</UI>
After you have accepted the license agreement (Control="Next") there are three options.
First you want to run a custom action "CS_Licens", this action change the INSTALL_WEB_RESPONSE property. Depending on the change the INSTALL_WEB_RESPONSE property, the installer somehow jumps back to the License agreement dialog and chose a new next event:
Event="NewDialog" Value="MyCustomDlg"
or
Event="NewDialog" Value="VerifyReadyDlg"
In other words: The value of the property INSTALL_WEB_RESPONSE controls the flow and the custom action is not (directly) involved in the flow at all.

Related

Separate Publish Event from Control

I have a UI dialog which is common to several WiX projects.
But according to the project, the dialog before (Back) or after (Next) that common UI may be different.
To avoid code duplication, I would like to have the common dialog alone (without the Publish Event) and the Publish Event for that UI defined in each WiX project.
Is it possible and how to do this?
Yes it is, you could just have a look at the wix source code under src\ext\uiextension\wixlib. You'll notice that all the dialogs are in their own file and the UI sets are separated.
For example, in WixUI_Mondo.wxs, you have DialogRef tags to import your dialogs and a bunch of Publish tags to reorder the sequence. In, say, InstallDirDlg, there are the controls, and next to no Publish tags.
Your UI would look like:
<UI Id="MyUI">
<DialogRef="WelcomeDlg"/>
<DialogRef="InstallDirDlg"/>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">CONDITION</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
</UI>
And in your dialog's file:
<UI>
<Dialog Id="WelcomeDlg" Width="370" Height="270" Title="Welcome">
<Control ... />
</Dialog>
</UI>
You can also have multiple InstallUISequence tags in your project. So if your dialog will always call a custom action, or be shown before another, you might as well put it in that file.
You can download the source code here

Removing license dialog

I'm using Wix 3.6 to make a simple MSI which is used internally. I would like to know if there is an easy way to remove the license agreement dialog.
Thanks for any suggestions
I skipped it using:
<UI>
<UIRef Id="WixUI_InstallDir" />
<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>
This simplification of the XML referred to above (http://www.howdoicode.net/2011/09/wix-how-to-hide-license-agreement.html) worked for me; this effectively skips the license rather than hooking in a custom page
<UI Id='Mondo'>
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="3">1</Publish>
<!-- skip the page on the way back too -->
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">1</Publish>
</UI>
I gotta say the general approach of copy the wix code and hack it about a bit ("Changing the UI sequence of a built-in dialog set"(http://wixtoolset.org/documentation/manual/v3/wixui/wixui_customizations.html)) is kinda doomed really.... but hey
I've recently come across a project Wix# that mimics the Wix XML files, but enables you code the setup in C#. You can find this project on https://wixsharp.codeplex.com. I initially had the same problem with a license file with the "Terms and Conditions" that need to be accepted before the user can install the software. With the solution not being of such a nature that it required "Terms and Conditions" to be accepted, I had to find a way to remove this dialog.
After a bit of searching (in Wix#), I came up with the following:
WixSharp.CommonTasks.Tasks.RemoveDialogsBetween(project,
WixSharp.Controls.NativeDialogs.WelcomeDlg,
NativeDialogs.InstallDirDlg);
Okay, I get that this doesn't solve the problem outright, because this will mean that you'd have to re-code your solution, so the next port of call was to look at the WiX Source File that was emitted during this process.
So from that, I saw that there was a <UI> element with the following:
<UI>
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="5">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="5">1</Publish>
</UI>
Which binds the Next button on the welcome dialog to the install directory dialog (or the dialog after the license dialog), and the Back button of the install dialog to the welcome dialog - effectively removing the license dialog box.
The key is to make a custom UI and hook up different pages. See the page on WixWiki
You want to grab the WixUI code for the dialog set you are using (e.g Minimal, etc), Call it <UI Id='MyAppWix_UIMinimal'> and modify it a bit and reference it in your main wxs. 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.
Here is a good link with code: http://www.howdoicode.net/2011/09/wix-how-to-hide-license-agreement.html

UPGRADINGPRODUCTCODE condition not working in wixui_install.wxs in library

UPGRADINGPRODUCTCODE condition not working in wixui_install.wxs in library
I want to change the value of next button to respective dlg if first time install and for major upgrade.
This is not working in wix library.
Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="PortNoDlg" >LicenseAccepted = "1" AND NOT UPGRADINGPRODUCTCODE
Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" >LicenseAccepted = "1" AND UPGRADINGPRODUCTCODE
UPGRADINGPRODUCTCODE is set only for the hidden uninstallation of a package found via the Upgrade table and FindRelatedProducts/RemoveExistingProducts. This does not show any UI, so conditioning control events off of this property will not be helpful.
By contrast UPGRADINGPRODUCTCODE is not set for the newer installation. If you want to condition your control events on whether a previous version will be uninstalled, you must reference the properties specified in the ActionProperty of each record in the Upgrade table.

wix ExitDialog Conditions

I have a Custom Action that launches an app from the ExitDialog Dialog, if the user ticks the check box that is. At any rate, my app has three features and the option to launch this app should only appear if one of the features has been installed.
I have the following code:
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="RCTPI" >
<![CDATA[LAUNCHUPONEXIT AND &WindowsService=3 AND NOT INSTALLED]]>
</Publish>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch Config Tool" > </Property>
I would have expected that the &WindowsService=3 meant that only if the WindowsService feature was selected to be installed, would the condition be met. However it appears regardless of what features are selected to be installed.
Any ideas?
TIA
YM
I suppose that by the moment ExitDialog is displayed, the referenced feature is already installed. Hence, you should probably use install state syntax instead of install action, i.e. !WindowsService=3. Never tried it myself though...
I've actually ended up doing an old fashioned custom action, I've spent enough time as it is on this.
<Custom Action="RCTPI" Before="InstallFinalize"><![CDATA[&WindowsService=3 and NOT INSTALLED]]></Custom>

What does EndDialog do?

I have a WIX installer and I am trying to work out what this line is actually doing (attached to the next button on my WIX dialog).
<Publish Event="EndDialog" Value="Return" >1</Publish>
It seems to me that this line means we are handing control back to the installer after showing our custom dialogs. But how does it then know which dialog to display next. It should in my case be showing the dialog indicating installation progress, but it jumps to the wrong dialog.
If I change it to this (ProgressDlg is the dialog showing installation progress in the WixUI_Minimal UI set which is the one I actually want to jump to),
<Publish Event="NewDialog" Value="ProgressDlg" >1</Publish>
It throws an error when I try to install
OK, I seem to have stumbled across something that now works, but I don't really understand why. Comments would be appreciated.
I have this dialog sequence,
WelcomeEulaDlg (part of WixUI_Minimal)
CustomInstall
StartAutomaticallyUI
IC3DatabaseSelection
GSDatabaseSelectionUI
ProgressDlg (part of WixUI_Minimal)
So basically I have created 4 dialogs that come between the EULA and installation progress dialog.
I had those dialogs inside an InstallUISequence block so that using orca would show those dialogs within the InstallUISequence table.
This seemed to be my issue. As soon as I removed the dialogs from the block and only had the first dialog in the block (which is CustomInstall) it worked fine.
Now it looks like this, whereas before that table had all the other dialogs
<InstallUISequence>
<Show Dialog="CustomInstall" After="WelcomeEulaDlg" >NOT Installed</Show>
</InstallUISequence>
The way I link those dialogs together and made them all included was just by linking the next and back buttons together. They didn't need to be in the InstallUISequence.
I got this idea from using the WixAware demo and creating a project in there.