WiX statement "CDATA[NOT Installed]" is not working - wix

I am trying to make the DemoDatabaseDlg dialog conditional, so if it is the FIRST time the user is installing the installer then "DemoDatabaseDlg" should be displayed. If it is NOT the first time installation then skip this dialog and jump to the next dialog.
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="DemoDatabaseDlg">1</Publish>
<Publish Dialog="DemoDatabaseDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">
<![CDATA[NOT Installed]]>
</Publish>
<Publish Dialog="DemoDatabaseDlg" Control="Next" Event="NewDialog" Value="PrepareDlg">1</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
However, after the first installation, when I try to increase the version number and re-install again, I still CAN see the DemoDatabaseDlg dialog. How can I skip this dialog using CDATA conditions?

Typically you have a Welcome dialog and a Maintenance dialog in the UI sequence as the first dialog. It's hard to say for sure without seeing the rest of your code or an installation log file but my guess is you are doing major upgrades and changing the ProductCode property with each build. In this scenario each new version is not yet installed from MSI's perspective.

Related

how to disable back button in setup build using wixtoolset on VerifyReadyDlg

I am making a customize setup using wixtoolset v 3.11
On the custom diaglog CustomDlgOTP the next button pass to VerifyReadyDlg
<Control Id="Next" Type="PushButton" Text="&Next" TabSkip="no" Default="yes" Height="17" Width="56" X="236" Y="243">
<Publish Event="NewDialog" Value="VerifyReadyDlg"><![CDATA[propertyreturncode = "200"]]></Publish>
</Control>
<!-- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomDlgOTP" Order="1"> NOT Installed </Publish> -->
I want user should not be able to hit back button from VerifyReadyDlg. I tried commenting but the button is still visible but with no action.
Need a way to disable the back button on VerifyReadyDlg
You disabled action bounded to that button, but didn't disable the button itself. You should rewrite VerifyReadyDlg, remove back button from it, and then add edited dialog to your UI instead of original one.
In Wix source code find file VerifyReadyDlg.wxs. Copy it to your project. In copied file rename Dialog Id="VerifyReadyDlg" to Dialog Id="MyVerifyReadyDlg"
In copied file delete/comment Control Id="Back" element.
In your UI (which you presented in question) add element <DialogRef Id="MyVerifyReadyDlg" />
In your UI replace all occurrences of VerifyReadyDlg to MyVerifyReadyDlg (commented part should stay commented)

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.

How to sequence Dialogs in 'Change' mode of Maintenance Dlg

I have created a few dialog screens for capturing custom information. I have sequenced the dialogs properly based on the Back and Next buttons of my custom dialogs. After the installation of the setup, when the user again launches the setup in Maintenance mode, the 'Change' button appears. In the Change mode, the UI sequence is not proper i.e. the wrong screen comes on clicking the Back or Next buttons. Also, some screens are not to be shown in the Change mode and the complete Dialog UI sequence needs to be set for change mode.
Please advise how can I sequence the DialogUI sequence in 'Change' option of Maintenance mode.
You can do it the same way you schedule the dialogs for new installation. For instance, take a look at the following snippet from WixUI_Mondo preset:
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog"
Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog"
Value="CustomizeDlg">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>
You can see how CustomizeDlg is set to go next after MaintenanceTypeDlg when you press Change button. Follow the pattern.
If I misunderstood your question, please elaborate further.