WiX - Custom Action (after installation) does not run on upgrade - wix

I have created a custom action that gets triggered via UI. It works fine for new install but fails during upgrade. However, if I run a repair from control panel, it then runs fine. I tried capturing msi log but it does not give any clue. Here are the snippets...
UI:
<Control Id="CloseButton" Type="PushButton" X="230" Y="243" Width="66" Height="17" Default="yes" Cancel="yes" Text="&Continue">
<Publish Event="DoAction" Value="ConfigureServer1">1</Publish>
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
Custom Action:
<CustomAction Id="ConfigureServer1" Impersonate="no" Directory="TARGETDIR" Return="asyncNoWait" ExeCommand="[#fileSetupDb] "[ProductVersion]" "[OCISUPGRADE]""></CustomAction>
Sequence for the UI file:
<InstallUISequence>
......
<Show Dialog="FinishedForm" OnExit="success" />
......
</InstallUISequence>
Any clues.... or anything I can try to debug etc.? I tried for a couple of days with no results. I am not a newbie in msi or wix and not an expert either.

I don't completely follow the question but I'll take a guess. When upgrading the "previous version of the product" (the MSI being removed) only has its InstallExecuteSequence run. So the custom action in the old version of the product in the InstallUISequence won't run.
If the question is why the custom action won't run in the new version of the product, then there isn't enough information here. You can look in the verbose log file to see what the result of the custom action with the matching Id.

Related

`<Show Dialog="CustomTextA" OnExit="success" />` does not work

I have the following code in my wxs file:
<UI>
<Dialog Id="CustomTextA"
Width="370"
Height="270"
Title="$(loc.InstallDirDlg_Title)">
<Control Id="NextButton"
Type="PushButton"
X="236"
Y="243"
Width="56"
Height="17"
Default="yes"
Text="$(loc.WixUINext)">
<Publish Event="EndDialog"
Value="Return"><![CDATA[CustomTextA_NextArgs=""]]></Publish>
<Publish Event="NewDialog"
Value="[CustomTextA_NextArgs]"><![CDATA[CustomTextA_NextArgs<>""]]></Publish>
</Control>
....
</Dialog>
<InstallUISequence>
<Custom Action="CustomTextA_SetProperty_EDIT2"
After="CustomTextA_SetProperty_EDIT1" />
<Custom Action="CustomTextA_SetProperty_EDIT1"
After="ValidateProductID" />
<Custom Action="CustomTextA_SetProperty_EDIT3"
After="CustomTextA_SetProperty_EDIT2" />
<Custom Action="CustomTextA_SetProperty_EDIT4"
After="CustomTextA_SetProperty_EDIT3" />
<Custom Action="ERRCA_UIANDADVERTISED"
Before="AppSearch"><![CDATA[ProductState=1]]></Custom>
<Show Dialog="CustomTextA"
OnExit="success" />
</InstallUISequence>
<AdminUISequence>
<Show Dialog="CustomTextA"
OnExit="success" />
</AdminUISequence>
</UI>
but CustomTextA dialog is not displayed when the installation finishes successfully, and standard ExitDialog is shown.
What can be wrong in the code?
I am not sure what the customs actions like Custom Action="CustomTextA_SetProperty_EDIT2" for, but I left them to provide the code as it is.
Wix version is 3.11 (Probably something went wrong after upgrading from an earlier Wix version).
Summary: Please try to download the sample below and have a look at it in Visual Studio. Also read the step-by-step description below for how to use it as a template. I would gather all GUI-markup inside the WixUI_MyMondo.wxs file. Be sure to skim the previous answers linked too.
WiX Custom Dialog Sample: I have a WiX custom GUI sample here (just click download). It is a "Hello WiX" kind of thing - intended to be as simple as possible, but no simpler. In other words it is just doing a couple of things.
It copies the standard WiX dialog source markup in the file WixUI_Mondo.wxs and calls the new file WixUI_MyMondo.wxs. It is put next to Product.wxs.
The main Product.wxs file then includes the customized version with <UIRef Id="WixUI_MyMondo" /> (instead of the standard <UIRef Id="WixUI_Mondo" />) allowing the WixUI_MyMondo.wxs file to be changed as desired.
The rest of the dialogs are linked from the WixUIExtension.dll file (as normal).
I always keep all the dialog events and configurations inside WixUI_MyMondo.wxs - meaning that I try to avoid dialog constructs inside Product.wxs.
Please download and check the sample. It is impossible - as far as I can tell - to deduce more from the markup you have provided.
Previous Answers: Here are two previous answers on the issue of WiX GUI. Rather than rewriting the content in a way that could miss your real question, please skim them will you?
General information on Custom WiX / MSI GUI
Changing dialog order
Links: Some further links here on setup GUI. Burn is WiX's setup.exe generator. It can have its own GUI separate from that embedded in MSI files.
Burn: WiX's bootstapper setup.exe generator: WIX Installer with modern look and feel
More on Burn: Removing Default dialogs from MSI

WiX created wizard launches the application but doesn't close itself

I would appreciate your help.
I have an installer made by WiX3.8. I needed to start application after having fulfiled installation. I found this HowTo.
In a word my application is launched, but I still have instalation wizard working. And if I press finish again the app launches again too.
So, there are two part of my wixfile:
I have CustomAction
<Property Id="WixShellExecTarget" Value="[#file19_launcher]" />
<CustomAction Id="LaunchApplication" Execute="immediate" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
and ExitDialog in a ui section:
<UI Id="GoWixUI_InstallDir">
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication" Order="1">NOT Installed</Publish>...</UI>
Please give me any suggestions you have on it.
Thanks.
Ok. I was forced to create my own Finish Dialog and add sequence of actions for finish button. But if someone knows why it doesn't work as it was mentioned, please welcome )

How to make sure FindRelatedProducts runs after the UI was shown using WiX?

I have a MSI installer and I specify per-machine installation in the installer UI. Previous version was also installed per-machine.
However, FindRelatedProducts reports that current install is per-user.
MSI (c) (A4:F0) [13:33:20:490]: FindRelatedProducts: **current install is per-user**. Related install for product '<<my guid>>' is per-machine. Skipping...
From the log I can see that ALLUSERS property is created only after FindRelatedProducts ran (note timestamp):
MSI (c) (A4:A8) [13:33:25:032]: PROPERTY CHANGE: Adding ALLUSERS property. Its value is '2'.
The property ALLUSERS is Published from the UI based on what the user selected:
<Publish Property="ALLUSERS" Value="2"><![CDATA[FolderForm_AllUsers="ALL" AND VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1]]></Publish>
<Publish Property="ALLUSERS" Value="{}"><![CDATA[FolderForm_AllUsers="ME" AND VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1]]></Publish>
<Control Id="AllUsersRadioGroup" Type="RadioButtonGroup" X="20" Y="175" Width="342" Height="42" Property="FolderForm_AllUsers" Text ="empty">
<RadioButtonGroup Property="FolderForm_AllUsers">
<RadioButton Value="ALL" X="0" Y="0" Width="342" Height="17" Text="$(loc.InstallForAll)" />
<RadioButton Value="ME" X="0" Y="18" Width="342" Height="17" Text="$(loc.InstallForMe)" />
</RadioButtonGroup>
<Condition Action="show"><![CDATA[VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1]]></Condition>
<Condition Action="hide"><![CDATA[NOT (VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1)]]></Condition>
</Control>
As a result, the new version is installed alongside the existing (two entries exist in Add/Remove programs).
<InstallUISequence>
<Custom Action="VSDCA_FolderForm_AllUsers" After="IsolateComponents"><![CDATA[Installed="" AND NOT RESUME AND ALLUSERS=1]]></Custom>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>
<InstallExecuteSequence>
<!-- Only schedule this custom action for the 32-bit MSI. -->
<?if $(var.DependenciesPlatform)=x86 ?>
<Custom Action="CA_Err32BitMsiOn64BitOS" After="LaunchConditions">
<![CDATA[MsiAMD64 OR Intel64]]>
</Custom>
<?endif ?>
<!-- Prevent downgrading -->
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
<RemoveExistingProducts Before="InstallInitialize" />
<Custom Action="LaunchApp" After="InstallFinalize" />
<InstallInitialize></InstallInitialize>
<RemoveShortcuts></RemoveShortcuts>
<InstallFiles></InstallFiles>
<CreateShortcuts></CreateShortcuts>
<InstallFinalize></InstallFinalize>
<ScheduleReboot After="InstallFinalize"/>
</InstallExecuteSequence>
This occurs only in case both versions of the app are installed per-machine, since FindRelatedProducts apparently assumes per-user installation (because it runs before the user was able to pick one of the radio buttons and therefore there is no ALLUSERS propety set at the time it runs).
How do I ensure that FindRelatedProducts is executed only after ALLUSERS was Published from the UI as specified by the user?
I found I need to add the following to ensure FindRelatedProducts runs within the UI after the user made his choice:
<Publish Event="DoAction" Value="FindRelatedProducts">1</Publish>
From https://www.mail-archive.com/wix-users#lists.sourceforge.net/msg22960.html
I found it is not strictly needed to use the suppress attribute - it seems to work also without explicitly suppressing the action in the InstallUISequence.

Prompt to uninstall older version of APP in WiX

I developed an installer using Wix 3.6 that installs successfully all elements of an application.
Now, each time I give an msi with a higher version, I want the installer to prompt the user to uninstall it. Since now I've tried this:
<Product
Id="*"
Name="!(loc.ProductName)"
Language="3082"
Codepage="1252"
Version="1.0.1"
Manufacturer="$(var.ProductManufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Property Id="PREVIOUSVERSIONINSTALLED" Secure="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="1.0.0.0" Maximum="99.9.9.9" IncludeMiminum="yes" IncludeMaximum="no" Property="PREVIOUSVERSIONSINSTALLED" />
</Upgrade>
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
</InstallExecuteSequence>
This code successfully uninstalls any previous installed version on my computer. But it doesn't ask the user if he's sure to do so.
What I need is Wix installer to prompt the user saying a message like:
A previous version of your [ProductName] is installed. Do you want to uninstall it? [ Yes | No ] option.
Is there any way to prompt user and check if he really wants to uninstall any previous version?
The Windows Installer Upgrade table has an attribute bit called msidbUpgradeAttributesOnlyDetect that is represented by WiX's UpgradeVersion#OnlyDetect attribute.
When properly authored this causes FindRelatedProducts to set an action property of your choosing with the ProductCode GUID(s) of detected products. It does not pass this off to RemoveExistingProducts for automatic removal though.
While not the typical behavior, there is nothing stopping you from writing some UI that gets triggered when this property has a value. You could ask the user if they want to remove the old version and if yes, set another action property to tell RemoveExistingProducts. (Hint: Author a Upgrade that would never find a product on it's own and hijack it's property to inject the removal. )
If the user says no, you have the choice of aborting the install or continuing the install side by side to a different directory structure. ( Office, Visual Studio et al ).
I found this post useful when solving the same problem. You can use the PREVIOUSVERSIONINSTALLED property you set in the upgrade-tag to open a custom dialog. Do this inside some UI-tags by adding the following code (when using the standard welcome dialog):
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg">PREVIOUSVERSIONSINSTALLED</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">NOT Installed AND NOT PREVIOUSVERSIONSINSTALLED</Publish>
I based my own custom dialog on this Wix tutorial, and ended up with the following code:
<Dialog Id="OldVersionDlg" Width="260" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="No" Type="PushButton" X="132" Y="57" Width="56" Height="17"
Default="yes" Cancel="yes" Text="No">
<Publish Event="EndDialog" Value="Exit">1</Publish>
</Control>
<Control Id="Yes" Type="PushButton" X="72" Y="57" Width="56" Height="17" Text="Yes">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30">
<Text>A previous version of [ProductName] is currently installed. By continuing the installation this version will be uninstalled. Do you want to continue?</Text>
</Control>
</Dialog>

Starting a second installer WIX

I have recently started creating installers in wix so i'm pretty new. Having a problem, When the user clicks a button i would like a second installer to start using a .exe file. However I cannot get my code to do this, im a bit confused as to which bit of code goes where but i have these three parts:
<Binary Id="HaspInstaller" SourceFile="visual studio 2010\Projects/ExampleInstaller/ExampleInstaller/bin/Debug/HASPUserSetup.exe" />
<CustomAction Id="HaspSetup" BinaryKey="HaspInstaller" ExeCommand="-switch"
Execute="deferred" Return="check" HideTarget="no" Impersonate="no" />
<Control Id="Hasp" Type="PushButton" X="40" Y="60" Width="56" Height="34" Bitmap="yes" Text="HaspImage" >
<Publish Event="DoAction" Value="HaspSetup" />
</Control>
Any help would greatly be appreciated..:)
N
That will not run when you click the button due to the Execute attribute set as deferred. Mark it as immediate and it will run as soon as you click the button.
Deferred is for use when elevation is required and has to be scheduled into the InstallExecute sequence.
Take a look at http://wix.sourceforge.net/manual-wix3/qtexec.htm which is the quiet execute custom action and the page explains nicely how to set it up for both deferred and immediate execution.
Also if that exe file is a bootstrapper for another msi, you will not be able to run it at all due to the fact that you will already be in one MSI transaction. In that case use burn to bundle the different installers into a single-installer user experience.