Stopping display of custom dialog boxes in WiX uninstall - wix

I have a WiX installer project that utilises a custom dialog box to ask for parameters to update a web.config file and run a database script on install. Everything works correctly and the application is installed and runs correctly.
However, the custom dialog box is also displayed when I uninstall the software and it certainly doesn't need to be (as I'm not updating a web.config file).
Is there a way to suppress the custom dialog when the application is being uninstalled?
(I should also remove the sql procs I install, at uninstall time but that is outside of this issue).

The solution to your question is to condition the custom action with the condition (Not REMOVE="ALL"). This will make the action run on fresh install and maintenance install, but not on uninstall. If you don't need to run on maintenance install, but only on a fresh install you can set the condition to be: (Not Installed AND Not(REMOVE="ALL")). Full list of MSI properties and brief descriptions here: http://msdn.microsoft.com/en-us/library/aa370905(VS.85).aspx.
The sequencing and custom action logic in MSI files is VERY complicated. It really pays off to avoid custom actions whenever you can.
There is more - all MSI files have built-in support for silent installation. This means that the entire GUI sequence can be skipped, and the MSI file installed without user interaction. This is a crucial feature for corporate deployment via SMS / SCCM or other deployment mechanisms. Showing a custom dialog box when the setup is run in silent mode is a violation of this basic MSI feature. You can work around this by properly conditioning the display of the dialog based on the property UILevel: http://msdn.microsoft.com/en-us/library/aa372096(VS.85).aspx. Just to keep things interesting and confusing Microsoft has defined 4 levels of GUI during an installation ranging from completely silent, through various options such as progress bar only etc... See the link for details.
I could add a lot of details here about MSI sequences, conditions, custom actions and similar, but it wouldn't answer your question. Please add any follow-up questions.

Wix snippet to show the creation of a custom action and its insertion into the InstallExecuteSequence:
<!--Custom Action Sample Section-->
<Binary Id='VBScriptCustomAction.vbs' SourceFile='VBScriptCustomAction.vbs'/>
<CustomAction Id='test' BinaryKey='VBScriptCustomAction.vbs' VBScriptCall='Hello' Return='ignore'/>
<InstallExecuteSequence>
<Custom Action="test" Sequence='4111'><![CDATA[NOT REMOVE~="ALL"]]></Custom>
</InstallExecuteSequence>
<!-- End of Custom Action Sample Section-->

Related

How to add Change button to the WiX Toolset (burn) Bootstrapper?

I need to add the Change button to my WiX (burn) Bootstrapper, so that it invoked the change action from the MSI that it's wrapping:
What markup do I need for that?
In WiX v3.x, you have to set the DisplayInternalUI attribute to yes to show the MSI UI. But the only time that the bundle can show the MSI's internal UI is during Install. The engine is hardcoded to force any other operation (modify, repair, uninstall, etc) to run silently. You'll have to write your own custom BootstrapperApplication in v3.x if you want the bundle to be able to modify an MSI, and the BA will have to have its own UI to do so.
In v4 (which isn't released yet), you can use wixstdba to show the MSI's internal UI for all operations but there isn't currently support for a Change button like you're asking for. It only supports Repair and Uninstall like in v3.x. No one has asked for that yet, so you might want to create a feature request at https://github.com/wixtoolset/issues/issues. Otherwise, you'd have to create a BAFunctions.dll to customize wixstdba.
The general recommendation for bundles is to use separate MSI's for different features instead of one MSI with all of the features.

Uninstallation condition for WIX

For installation, we have a property "Install" which we can use in conditions to execute if its undergoing installation. Do we have a similar property for Uninstallation?
You can use REMOVE~="ALL" to detect a full uninstallation.
An uninstall performed as part of a major upgrade can be detected via the UPGRADINGPRODUCTCODE property.
Here is some further advice and some help resources: here is a "MSI Conditions Cheat Sheet" to help you get the complicated MSI conditions for custom actions right. The sheet looks fine to me, but I have not tested it in detail - just sharing the link with your own testing as the only guarantee.
Also, you can check out Stefan Kruger's msifaq.com for a list of common MSI questions as well as his main installsite.org site for general deployment information.
With regards to Wix check out this well known wix tutorial. I'll throw in a link to the Windows Installer Best Practices list as well.
How to add a WiX custom action that happens only on uninstall (via MSI)?

How to modify the installed features of msi with wix bootstrapper?

I am trying to call a msi inside wix bootstrapper program.It is working properly at the time of installation.And selected features are installed properly.But after installation i am trying to modify the installed features.In the control panel there is change button.But when i click it then it is showing a dialog with Repair, uninstall, cancel buttons.There is no modify button for modifying the features of installer.
Please specify the solution if any.
code inside Bootstrappertheme.wxl is
<!-- Modify dialog -->
<String Id="ModifyHeader">Modify Setup</String>
<String Id="ModifyNotice">[WixBundleName] is already installed on this machine. If it's not working correctly, you may repair it. You may also uninstall it.</String>
<String Id="ModifyRepairButton">&Repair</String>
<String Id="ModifyUninstallButton">&Uninstall</String>
<String Id="ModifyCloseButton">&Cancel</String>
The wix standard bootsrapper application does not currently support msi feature selection. Currently, the only way to get it is to create a custom bootstrapper application. People have asked about this on the WiX mailing list multiple times. Rob Mensching is the project leader, and Bob Arnson currently manages the 3.x branch.
This guide: Writing Your Own .Net-based Installer with WiX is the best resource I know about for building one in WPF. The actual WiX source code is very helpful as well. It's a very big task though.
I don't have a sample project to share with you, but the blog post I mentioned above does have a section "HANDLING CURRENT & FUTURE STATE" which describes how to do this. I think it really is a terrific resource.
Also, see this question: Custom WiX Burn bootstrapper user interface?
Burn GUI
Burn GUI is very different from MSI-GUI. Here is an older, similar answer
Please also see comments in these answers:
On customized GUI
Changing text color to Wix dialogs
Custom WiX Managed Bootstrapper Application
MSI File
What dialog set are you using for the MSI files? Have you tried enabling the advanced dialog set? I haven't tried it yet: http://wixtoolset.org/documentation/manual/v3/wixui/dialog_reference/wixui_advanced.html
WixUI Dialogs:
http://wixtoolset.org/documentation/manual/v3/wixui/dialog_reference/wixui_dialogs.html
Tutorial:
http://wix.tramontana.co.hu/tutorial/user-interface/ui-wizardry
It might be possible to use Orca (http://support.microsoft.com/kb/255905) to edit the MSI and resave it so that it, without special configuration in wix, automatically has the Modify option in Programs and Features. When creating an MSI from scratch (using InstallShield for example), the user can specify which options are available. There should be a way to edit the file to accomplish the same thing.
When you open up the "Change" feature from the Programs and Features menu, it reruns a cached version of the MSI installer in maintenance mode. Regardless of what program is bootstrapping the MSI (wix vs InstallShield), the MSI is the only thing that Windows knows about. If it is not configured to have a Modify option, it won't have it.

Why won't Windows Installer use the UI in the .msi file during removal?

Has anyone been able to get Windows Installer to use the InstallUISequence table during removal?
I started with an MSI file produced by the Visual Studio msi builder, decompiled it into WiX source code and handcrafted it, but I cannot get the installer to use my UI during removal. It insists on using a default UI provided by Windows Installer.
I have also analyzed several MSI files, and I have been unable to find one where Windows Installer will use the provided UI during removal.
I captured the msiexec logs during removal, and sure enough, Windows Installer appears to be ignoring the InstallUISequence table.
It seems that msiexec runs with minimal UI during removal. If I specify the /qf switch (use full UI) during removal, then Windows Installer does take the UI from the .msi file. However, this doesn't help the regular user, because she won't do the removal from msiexec.
Does anyone know of a way to convince Windows Installer to use the UI in the MSI file by default?
When removing an application from Add/Remove Programs, this will always run with "basic" UI.
You can't make uninstall run with full UI, the best you can do is prevent removal and force people to 'modify' (which does run with UI) and remove from there.
Whatever you do, there's still no way to prevent someone right clicking on the original MSI and selecting 'Remove', this will always run with basic UI.
The "Why" is basically because Microsoft says so. :-) Can't say I disagree as I get annoyed when ISV's get all cute when I'm just trying to remove a program.

WIX MSI Package Uninstallation

I am using WIX for an installer package. When I uninstall the package by double clicking the original msi package everything is fine.
When I uninstall from the control panel it gives me a miminal UI uninstallation. I have written into my MSI a custom action which asks the user whether they want to uninstall some databases etc. This does not occur on the minimal UI uninstallation.
How can I make the uinstall from control panel work with a full UI?
A reply by Bob Arnson in this thread:
Yes, that's the behavior of the
Add/Remove Programs applet. It always
uninstalls MSI packages in basic mode
after prompting. The only thing you
can do is set ARPNOREMOVE to force a
user to use maintenance mode -- and
surface a Remove option in your
maintenance UI.
You can't do that natively with MSI. You'd need to refer to a boostrapper/external UI to do the uninstall. The other answers to this question point in the right direction.
Look at the registry key for your product in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. In there look at the Uninstall value and see if adjusting it does what you want.
I'm pretty sure that there is a property in the MSI for this if that fixes your issue I just can't remember it off the top of my head. Searching the MSI for the string you find in the registry should help you suss it out though.
You can make ARP menu show only Remove/Change button(it opens your maintenance dialog) for your app by deleting 'ModifyPath' registry value under HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{YourProductCode}. And place both remove and change options in your maintenance dialog.
PS. For this method to apply make sure that you don't have any of the following registry values set to 1 under the registry key stated above: NoRepair, NoRemove, NoModify, WindowsInstaller.