WiX 3.7: How to add or update a dialog during uninstall? - wix

I need to add a dialog box that would pop up during complete uninstall (not major upgrade) right after the confirmation ("Are you sure you want to uninstall this product?") dialog. This dialog would prompt the user to answer a question and based on the response, set up a property that would be used in the condition for the RemoveRegistryKey element (i.e. it will remove a registry key only if the user selects an option to delete the key).
I have an idea how to add a dialog to the install sequence (I am using a modified WixUI_InstalLDir sequence to which I added a custom dialog I need during installation), but I can't find any references that would explain how to add a custom dialog to an uninstall sequence. It would be even better if I could modify the uninstall confirmation dialog, so the user would see one dialog instead of two. An the key thing would be to be able to set up a property that could be used in the component condition.
Is this possible? Are there any examples how to do this?

This is against Microsoft design guidelines. Add/Remove programs calls the uninstall with a silent UI argument and the UI sequence is never processed.
The only place you can author UI during an uninstall is a "change" or "maintenance" UI experience where they select Repair | Change | Remove and on Remove do your UI. But you'd have to lock down the Remove buttom and force them through this path. Also realize they could call msiexec /x /qb from the command line.
Bottom line is Microsoft made this choice to make the uninstall process simple and easy for the user. As for removing the registry key, Microsoft would say that you should leave user data on uninstall.

Related

How can I set the wizard to go back if an error is found in a Custom Action

If I find an issue from within my Custom Action checks (user chose a bad install directory in the WixUI_InstallDir dialog), after I let the user know of it (by using the _session.Message), can i somehow go back to that page in the wizard (the one that shows the install dir dialog)?
Right now I just return a ActionResult.Failure which is not ideal since he'll need to run the MSI all over again.
Update: I just noticed that when I return ActionResult.Failure, i'm still in the wizard with the "... wizard ended prematurely" message. The Finish button is enabled but the Back is not. Can I somehow change that so that the Back is also enabled? That would solve my problem.
Thanks.
Don't return a failure. Instead, set a MSI property (e.g. VALID_INSTALLDIR) to 1 or 0 based on your validation requirements. Then, condition the 'Next' button's SpawnDialog event on VALID_INSTALLDIR=1. This will keep the user from advancing to the next dialog until they choose a valid install path.

FilesInUse cannot be modified and CloseApplications does nothing

I've googled this to death and cannot find a solution that works.
We need to prevent the user from re-installing our app while it's still running. The standard FilesInUse dialog works but it still allows the user to continue while the app is running and we dont want to force them to reboot - ie, they have to shutdown the app manually.
We tried to create a custom FilesInUse dialog:
We include the FilesInUse source and remove the Ignore option
Rename the ID of the dialog
Change the DialogRef in the Mondo UI
Add an suppress for ICE20 because it complains the FilesInUse doesnt exist if we dont do this.
The new dialoag is never used.
If I leave the id of FileInUse unmodified then I get an error about a duplicate dialog.
Ive also tried using utils:CloseApplications but this never does anything.
So: What is the current thinking on how to do this?
Thanks
PS, I love Wix but it does frustrate me at times :) Much like the wife...
Looking to achieve the same thing, I discovered the answer in the related question: Including modified FilesInUse dialog in WIX project.
Remove the DialogRef entry of FilesInUse from the UI file, and replace it with the custom Dialog for FilesInUse directly in the UI file.

How can I get more text onto the WelcomeDlg?

I've got some verbose text that's being truncated on my WelcomeDlg:
Clearly there's loads of room in the dialog for the extra lines of text, but the text box is too small. How can I make it larger?
You can take a look at the source for the WelcomeDlg to see what is happening. The text you are displaying is the <Control Id="Description" .... />, but you'll notice there is also another text field below it for describing a patch if it is being applied.
You can customize the WelcomeDlg by following the instructions in the last couple of section of this page in the manual. Here are some quick steps:
Copy the fragment for the WelcomeDlg into your own project from the Wix sources.
Change the Id attribute of the Dialog tag to be unique. You can then make any changes to the dialog you need (such as making the patch description field smaller and the description field taller).
Copy the fragment that defines your UI sequence from the Wix sources into your project. If you were using the WixUI_InstallDir sequence you would copy this file.
In your custom dialog sequence file you need to change the Id attribute of the UI tag to be unique and any references to WelcomeDlg to the Id you put on your custom WelcomeDlg.
In your main package change your <UIRef Id="..." /> tag to reference the custom dialog sequence.
Not to dismiss your requirement outright, but I would keep in mind that the attention span of a user running an installer is about that of a 2 year old. They likely won't read whatever you are putting there in the first place. Same goes for that EULA that management always wants to make sure the user scrolled all the way through before being allowed to click I Accept.
I follow a minimalist approach when creating installer UI. Next, Next (if needed), Install, Finish. Still don't quite like the Install Finish pattern but some do.

WIX: how to specify different text on exit dialog for repair and remove?

I'm using WIX 3.0
After I install my product, I can run installer again and remove or repair my product.
How to specify different text on exit dialog for repair and remove?
I used "Installed" property, but it has the same value for repair and remove
Do you have any ideas?
Thanks in advance
You'll have to modify the ExitDialog.wxs for this (taking it from WiX sources and including to your project).
Take ProgressDlg.wxs as an example. It contains several pairs of controls, prefixed with 'Text' and 'Title', for instance 'TextInstalling' and 'TitleInstalling'. These pairs of controls are located at the same positions on a dialog, but are conditioned differently. For instance, 'TextRemoving' and 'TitleRemoving' are shown when WixUI_InstallMode='Remove'. Hence, setting WixUI_InstallMode to 'Remove' at the beginning of uninstall shows "Removing files", etc. on a progress dialog.
You can use this technique for other dialogs as well.
Thanks for update, Yan.
My problem was not how to change some text, but how to know what action was performed, remove or repair.
I don't know if this is good solution, but I used custom action and set the all text I need in the properties. The custom action runs with condition $MyInstalledComponent=2, which means that component is removed and is TRUE only on remove, but not on repair

Prompting for user confirmation before upgrading previous version

Using WiX, we would like to be able to uninstall a previous version if it is already installed. I am able to do this automatically based on the thread here.
But how does one go about prompting the user if they actually want to uninstall the old version first, before running the RemoveExistingProducts action? ie. through a custom menu item that only launches if FindRelatedProducts returns 1, for example?
You can try this approach:
In Upgrade table define a rule for older product versions:
http://msdn.microsoft.com/en-us/library/aa372379(VS.85).aspx
For this rule set the ActionProperty column to a custom property, for example OLDER_PRODUCTS
Use this property to conditionally show a custom dialog in which the user can select if he wants an upgrade or not.
Use the properties in the custom dialog to condition RemoveExistingProducts standard action.
This way the upgrade rule detects older versions and shows a custom dialog if it does. This custom dialog can then take the user choice and use it to skip the upgrade.