Don't install if a program is running - wix

I have a wix installer. How can I prevent the install if a program is running? I don't want to have the installer close the program. It may not be in a state where it is safe to close. I want to tell the user they need to close the application and either wait for the user to close it, or just exit the install.

I removed <DialogRef Id="MsiRMFilesInUse" /> and that appears to prevent the installer from prompting to close the application.
However, the default FileInUse dialog allows you to ignore the fact that files are in use. I tried to find a way to remove the ignore option but was unable to. The best option I could come up with was to remap the "Ignore" button to "Exit".
<Publish Dialog="FilesInUse" Control="Ignore" Event="EndDialog" Value="Exit">1</Publish>
I first tried to map "Ignore" to "Retry". That worked the first time the FilesInUse dialog appeared, but not after your retried once.
This is definitely a hack, but its the best option I've found so far.

Related

Attempt to install earlier version of the installed application causes error

I have created a custom UI and provided the standard dialog boxes as required to avoid ICE20 errors. I have included the following line as required:
If I use a WIX UI this works fine. But now I've created my own custom UI I get an "unexpected error" message with error code 2814 and then one with 2869. Does anyone know how to catch the attempted downgrade to produce a dialog box with the correct message?
I am not an MSI dialog expert, but there are a few things I can point out:
You can customize the internal GUI built into an MSI.
You can also make your own GUI for Burn setup.exe launchers.
Burn GUIs can be more modern than the rather ancient MSI GUI.
A Burn launcher can hide the built-in MSI GUI during installation.
I am not sure what GUI you have customized?
Error 2814: The error code 2814: "On the dialog [2] the control [3] names a nonexistent control [4] as the next control." - this seems to indicate that a control on your dialog points to a non-existent control as the next one to go to for the TAB order of the dialog. You need to point to a valid control that exists and it should be visible too.
Custom MSI GUI: Making your own MSI GUI is rarely advisable unless you need something very specific and unusual. You can use existing dialog sets and just inject a new dialog (which might be what you have done). Due to the lack of flexibility for MSI dialogs I would recommend that you make a Burn setup.exe GUI if you really need a lot of flexibility. I have not looked at this a great deal.
WiX MSI Dialog Sample: There is a sample, modified WiX MSI dialog set here: https://github.com/glytzhkof/WiXCustomDialog
Links: I have a few links on MSI dialogs and Burn GUI. This is quite overlapping, please just skim and see what makes sense to you:
WIX Installer with modern look and feel
Changing text color to Wix dialogs
Wix default folder dialog
Removing Default dialogs from MSI
Other Links:
A very clever effort from Stefan Kruger to work around the MSI GUI dialog limitations: http://www.installsite.org/pages/en/msi/articles/MultiListBox/index.htm
Dynamically changing RTF content in the EndDialog after success
https://github.com/frederiksen/Classic-WiX-Burn-Theme
How to add image background to custom MSI dialog?

WiX Installer: How to hide/remove the Welcome dialog in WixUI_InstallDir mode

I am trying to remove the WelcomeDlg from the built-in WixUI_InstallDir dialog set.
For creating the setup executable and adding prerequisites , I used the bootstrap application where in I bundles the created msi. Now the issue is the bootstrap comes with its own Welcome dialog and the embedded msi also shows its own dialog box. In order to get rid of the msi welcome dialog, I
have removed the Publish statemnts related to Welcome dlg from the custom WixUI_InstallDir.wxs. But I am not able to get hide the welcome dialog.
Is there any way to get rid of the msi welcome dialog ?
Recently I also faced similar kind of situation where I need to exclude showing WelcomeDlg. Our idea was to create a custom license agreement dialog as the first dialog of the UI.
In order to achieve that behavior, following changes have been made.
Created a new wxs dialog with id "AdvancedWelcomeEulaDlgEx" which shows the EULA, checkbox to accept and Next button.
In this dialog's InstallUISequence, added the following line.
<InstallUISequence>
<Show Dialog="AdvancedWelcomeEulaDlgEx" Before="ProgressDlg">NOT Installed</Show>
</InstallUISequence>
Suppress the WelcomeDlg from showing. We used an approach like below in main UI fragment (Condition ensures that it won't show in normal case; In our case Installed and Patch case never happens as it is the way it handled)
<InstallUISequence>
<Show Dialog="WelcomeDlg" Before="AdvancedWelcomeEulaDlgEx" >Installed AND PATCH</Show>
</InstallUISequence>
You can check out this link which explains a similar kind of approach.
Basically the idea is to suppress the Welcome dialog and use the next dialog or custom dialog as initial one. Also, the Publish events of Next and other dialog's events should be rewired accordingly.

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.

wix disable repair from add remove programs but not from maintenacetypedialog

I am creating installer in wix.
I want to disable repair from Add Remove Programs, but not from MaintenanceTypDialog.
I have set ARPNOREPAIR to 1. Repair doesn't appear in ARP as expected, but the Repair button is also getting disabled in the Maintenance dialog.
Can anyone please help. I am new to wix.
The Maintenance dialog relies on the ARPNOREPAIR property value as well, that's why when you set this property, the repair option is disabled in both places.
First of all, you should think carefully whether you really want to disable repair in one place, and leave it as is in another one. If that's truly the case, you should modify the Maintenance dialog the way you'd like (for instance, change the condition which disables the Repair button) and inject this modified dialog into the UI sequence.
This might sound pretty scary for beginner, that's why I suggest you starting from the "Customizing Built-in WixUI Dialog Sets" article in WiX.chm file.
Or you can set ARPNOREPAIR in a CA after MaintenanceWelcomeDlg. It seems to work for me. For example,
<CustomAction Id="CA_Set_ARPNOREPAIR" Property="ARPNOREPAIR" Value="1" />
<InstallUISequence>
<Custom Action="CA_Set_ARPNOREPAIR" After='MaintenanceWelcomeDlg' />
</InstallUISequence>

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.