When closing my application it prompts users to save any unsaved information. When installing a new version of my application while it is running the following occurs:
Start application.
Install new version from WIX MSI.
Application prompts to save unsaved information.
WIX MSI ignores the fact the application is not closed and continues uninstalling the old version and installing the new version.
The still running application crashes badly.
How can I get WIX to abandon the installation if the application does not close?
As per my understanding, you want to stop the installation and inform customer to close the application if your application is running.
You can do this using custom action. Check your application is running or not using Process and create a property based on that in custom action.
Schedule the custom action after AppSearch or before Launch Condition in both InstallUI and InstallExecute (for silent installation) sequences. Check that property using condition element.
<Condition Message="Please close XXXX application to continue the installation." >APPLICATION_RUNNING</Condition>
Related
I have an MSI that was authored using WiX. It installs a VSTO office addin. With an office application running (and thus the addin loaded) instead of a FilesInUse dialog with retry, ignore, cancel I only get a retry and cancel. The installer log shows a 1306 then a 1603 error. In interactive mode InstallValidate says there's an exclusive lock on this file. The installer seems incapable of overwriting this file via delayed reboot.
I've set MSIRESTARTMANAGERCONTROL to Disable for testing purposes. Eventually this will be called by a burn exe but I'm trying to get my head around the root issues first. Currently burn displays the retry/cancel dialog and if I run it with /passive /norestart it just tries to install the MSI 4 times and then fails.
The interactive experience isn't too horrible (close the app dummy!) but the silent experience fails and doesn't do the force install /reboot that I normally see.
What important trivia am I not remembering?
Update: I set MSIRESTARTMANAGERCONTROL back to it's default and set MSIRMSHUTDOWN to 1 and this has fixed all the silent MSI installation scenarios. However when I have WiX Burn run it as an MsiPackage it fails. I think it's because Burn is passing MSIFASTINSTALL=7 which skips some of the costing steps. I tried adding MSIFASTINSTALL=0 but I see both getting passed to the MSI and the behavior doesn't change.
I have a WiX installer project which installs a client app and a windows service. It is set to stop the service during install. However it still shows the error window "The following applications are using files which the installer must update" with the "Try Again", "Continue" and "Cancel" options. If I choose continue and inspect the windows event logs for the installer it shows the service being stopped and started again. The StopServices element is in the recommended sequence position.
How can I avoid the error window?
[Edit] My understanding is that it doesn't matter what order the files are listed as windows installer stops the service before copying any of them. I had wondered whether the service exe needed to be listed first.
Best solution: Use the "ServiceInstall" and "ServiceControl" elements to ensure the service is stopped/started (and installed/uninstalled) correctly.
In fact in our installer the app and service were being stopped/started from within custom installer code. However the check for whether the files are in use occurs before the custom installer code is run. So the files are in use when the installer starts, but are not in use by the time the installer attempts to copy the files. So annoying to the user, but not actually an issue. And if installed using msiexec.exe in quiet mode then the install succeeds.
Furthermore we had another issue with the service returned from the shutdown call, prior to actually having shutdown. (As commented by #PhilDW).
In an msi, we use the following to get explorer to restart so that it loads our shell extension.
<util:RestartResource Path="[WindowsFolder]explorer.exe"/>
However, now that I've wrapped this msi up with its dependencies in an installer created with burn, the restart of Explorer no longer occurs.
How can I get the restart to still occur?
Thanks.
The msi normally displays some UI asking the user to reboot. This UI is hidden when wrapped in a burn/bundle exe. I thought perhaps the burn engine would issue callbacks allowing a custom bootstrapper to display the relevant UI. I tried overridding OnExecuteMsiMessage in a custom bootstrapper application, but don't see any message that would appear to give me an opportunity to display the UI that's required for the Explorer.exe restart.
I've created an installer using WiX and if the user tries to uninstall my application whilst it is still open, they should get the dialog which gives them the option to have the uninstaller close the application automatically or leave it running but a restart will be required.
It seems though that with User Account Control on, I need to elevate by running the package with msiexec from an elevated command prompt before this will happen. If the user is not elevated, the uninstaller will run, they click the Remove icon (which prompts for elevation), but the setup then simply says:
"The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup."
I'd like them to have the option to close the app even when just uninstalling without having to manually elevate first
My best guess is that your MSI does not have a FilesInUse dialog box nor a MsiRMFilesInUse dialog box. Those are "well-known" dialog boxes that the Windows Installer will populate with information when it detects files in use. The WiX toolset should give you those dialogs automatically if you use one of the standard UIs. Alternatively, you can create your own dialogs.
I have created a WiX installer and would like to launch a custom action dialog on uninstall. From this dialog I would like to gather information on why the user is uninstalling my application (well, this means just launching the web-browser).
I have seen some people using the On="uninstall" property, but I am not sure if this is the one to use, and how to use it, for the above action.
Windows doesn't show UI when a product is uninstalled from Add/Remove Programs or Programs and Features.
JakobJ: I wouldn't mess with this uninstall sequence. Any modal dialog that pops up when the installation is run in silent mode (which it is from add/remove) could cause your entire product to be axed in a corporate environment. If your uninstall is invoked from a management system such as SCCM and the uninstall on a lot of machines fails because the uninstall gets stuck on a dialog, this will not soon be forgotten. Trust me.