Installer does not close after running custom action - wix

I've made my Wix installer run an application after finishing installation. This now works, but the installer does not close. Every time I click the Finish button, the application is started once more.
I'd like the application to be run async and then installer terminate.
This is how I did it in Wix;
<UI>
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.ProductName) Launcher" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<CustomAction Id="LaunchApplication" FileKey="LnLauncherExe" ExeCommand="" Execute="immediate" Return="asyncNoWait" Impersonate="yes" />
An other problem I have is that the checkbox does not show up. I can live with this, but if someone can spot why, it would be nice to get fixed.
Thanks!

Adding the following seems to work;
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

Related

Hide WIXUI_EXITDIALOGOPTIONALCHECKBOX with condition

My setup consists of 6 features.
I have feature named "Server".
If Server feature is not installed WIXUI_EXITDIALOGOPTIONALCHECKBOX should be disabled or hidden.
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 AND NOT Installed</Publish>
<Property Id="WixShellExecTarget" Value="[#exefile]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch application"/>

How to run multiple installed exe's using wix installer?

I'm trying to run multiple exe's after installation. This code creates single msi that deploy both exe's but run the first.
I haven't found a single example for it at the whole internet. This is my code (Don't mind the "put guid here"):
<?xml version="1.0" encoding="UTF-8"?>
<<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
UpgradeCode="PUT-GUID-HERE"
Version="1.0.0.0"
Language="1033"
Name="My Application Name"
Manufacturer="My Manufacturer Name">
<Package InstallerVersion="300" Compressed="yes"/>
<Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="My Application Name"/>
</Directory>
</Directory>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="Installs" Guid="PUT-GUID-HERE">
<File Id="myapplication.exe" Source="MySourceFiles\MyApplication.exe" KeyPath="yes" Checksum="yes"/>
<File Id="myapplication2.exe" Source="MySourceFiles\MyApplication.exe2" KeyPath="yes" Checksum="yes"/>
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="Installs" />
</Feature>
<UI>
<UIRef Id="WixUI_Minimal" />
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch My Application Name" />
<Property Id="WixShellExecTarget" Value="[#myapplication.exe]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
</Product>
</Wix>
But it only installs the first exe upon completing setup. Ideas?
Best Regards.
A component can't have multiple keypaths. Each EXE file should be the keypath of it's own component per Windows Installer component rules.
I don't see how anything would launch. [#myapplication.exe] is a formatted expression that's not valid until after ConstFinalize. You'd need a SetProperty custom action scheduled appropriately to work. You'd need more then one also to call LaunchApplication over and over for each EXE you want to launch. Or create a single custom EXE who's sole purpose is to launch the others.
You can just do it 2 times: First set the property "WixShellExecTarget" and then call "WixShellExec". I.e. try replacing with custom actions to set the property:
<UI>
<UIRef Id="WixUI_Minimal" />
<!-- set property and launch the first exe -->
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="PrepareLaunchApplication1">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication1">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
<!-- set property and launch the second exe -->
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="PrepareLaunchApplication2">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication2">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch My Application Name" />
<CustomAction Id="PrepareLaunchApplication1" Property="WixShellExecTarget" Value="[#myapplication.exe]" />
<CustomAction Id="LaunchApplication1"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
<CustomAction Id="PrepareLaunchApplication2" Property="WixShellExecTarget" Value="[#myapplication2.exe]" />
<CustomAction Id="LaunchApplication2"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
If you want for programs to be run sequentially and wait for the second one to exit and check it's exit code, you can use "ExeCommand" instead of "WixShellExec". If you don't care about exit code, you'll need to configure ExeCommand correspondingly (check the docs).
<UI>
<UIRef Id="WixUI_Minimal" />
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication1">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication2">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<CustomAction Id="LaunchApplication1" FileKey="myapplication1.exe" ExeCommand="" Impersonate="yes" />
<CustomAction Id="LaunchApplication2" FileKey="myapplication2.exe" ExeCommand="" Impersonate="yes" />

Remove "Installation successful" Dialog

I'm having a problem with the wix installer.
I want to remove the last dialog window when installing my application. The last dialog only shows the message "installation successful" and the user has to click finish.
I want the installation to close automatically after the progress bar reaches 100%.
I tried the approach Changing the UI sequence of a built-in dialog set but i got numerous errors and could not get it to work.
I also tried user "joylons" answer here but had no success either.
Is there another way to get this to work? Or can someone help me with the mentioned approach?
I am using the WixUI_Minimal scheme:
<UI>
<UIRef Id="WixUI_Minimal"/>
</UI>
EDIT:
Based on other answers I tried to use WixUI_Common and alter the sequences.
<UI>
<Property Id="WIXUI_INSTALLDIR" Value="TARGETDIR" />
<Property Id="WixUI_Mode" Value="Custom" />
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="9" Bold="yes" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="FatalError" />
<DialogRef Id="UserExit" />
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="EndDialog" Value="Return" Order="1"></Publish>
</UI>
<UIRef Id="WixUI_Common" />
<InstallUISequence>
<Show Dialog="WelcomeDlg" Sequence="1"/>
</InstallUISequence>
<AdminUISequence>
<Show Dialog="WelcomeDlg" Sequence="1"/>
</AdminUISequence>
Changes to the InstallUISequence or AdminUISequence do not seem to have any impact. The installer still shows the three dialogs: licence, progress and then the finished dialog.
I tried to remove the Publish Dialog="ExitDialog" and get the error: "Exit dialog/action not found in 'InstallUISequence' Sequence Table"
EDIT2: I changed my UI Tag like this (according to Chris Eelmaa's answer):
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<UIRef Id="WixUI_Minimal"/>
<UI>
<InstallUISequence>
<Show Dialog="ExitDialog" OnExit="success">0</Show>
</InstallUISequence>
<AdminUISequence>
<Show Dialog="ExitDialog" OnExit="success">0</Show>
</AdminUISequence>
</UI>
Unfortunatelly the dialog is still shown at the end of the installation process...
EDIT3 (25.03.15)
The problem seems to be the bootstrapper I'm using. Without the bootstrapper Chris Eelmaa's solution works. The bootstrapper seems to ignore all of the changes i make in my .wxs file and still displays the ExitDialog. Any suggestions?
It's pretty easy, basically you need to overwrite the scheduled "Show exit dialog when installation was successful", and say that it should never happen. The "0" means disabled.
<InstallUISequence>
<Show Dialog="ExitDialog" OnExit="success">0</Show>
</InstallUISequence>
<AdminUISequence>
<Show Dialog="ExitDialog" OnExit="success">0</Show>
</AdminUISequence>

WiX - start application after install

I read an article http://wix.sourceforge.net/manual-wix3/run_program_after_install.htm and it works.
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch MS" />
<Property Id="WixShellExecTarget" Value="[#MainExe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Minimal" />
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
<UIRef Id="WixUI_ErrorProgressText"/>
</UI>
But I want to have checked checkbox by default, not unchecked. How to do it
Add <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" /> to give the checkbox property its "checked" value.
It goes outside the UI element. Here's a complete example:
<UI>
<UIRef Id="WixUI_Minimal"/>
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed
</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>

WiX: Can't handle "Launch an application after install" checkbox = 0

I'm making an installation with WiX that have a "Launch an application after install" checkbox.
The goal is to have a reaction on settting the checkbox as well as on unsetting the checkbox. In case the checkbox is set, I need to run an application. In case the checkbox is not set, I need to run the same application but with command line argument.
Here is a part of my WiX script.
<CustomAction Id="StartConfigManagerOnExit"
FileKey="ParamsShower.exe"
ExeCommand=""
Execute="immediate"
Impersonate="yes"
Return="asyncNoWait" />
<CustomAction Id="StartUpgradeConfigOnExit"
FileKey="ParamsShower.exe"
ExeCommand="/upgrade"
Execute="immediate"
Impersonate="yes"
Return="asyncNoWait" />
<UI>
<Publish Dialog="ExitDialogEx"
Control="Finish"
Order="1"
Event="DoAction"
Value="StartConfigManagerOnExit">LAUNCHAPPONEXIT = 1</Publish>
<Publish Dialog="ExitDialogEx"
Control="Finish"
Order="1"
Event="DoAction"
Value="StartUpgradeConfigOnExit">LAUNCHAPPONEXIT = 0</Publish>
<Publish Dialog="ExitDialogEx"
Control="Finish"
Event="EndDialog"
Value="Return"
Order="999">1</Publish>
<Dialog Id="ExitDialogEx"
Width="370"
Height="270"
Title="[ProductName] Setup">
<Control Id="LaunchCheckBox"
Type="CheckBox"
X="135"
Y="190"
Width="220"
Height="40"
Property="LAUNCHAPPONEXIT"
Hidden="yes"
CheckBoxValue="1"
Text="Launch an app">
<Condition Action="show">NOT Installed</Condition>
</Control>
</Dialog>
<InstallUISequence>
<Show Dialog="ExitDialogEx"
OnExit="success" />
</InstallUISequence>
<AdminUISequence>
<Show Dialog="ExitDialogEx"
OnExit="success" />
</AdminUISequence>
</UI>
An installation starts the application when LaunchCheckBox is set. But it doesn't run it in case the checkbox is not set.
I've found an answer. Looks like checkbox property is not equal to 0 when unchecked. Simply change the condition "LAUNCHAPPONEXIT = 0" with "NOT LAUNCHAPPONEXIT" solves the situation.
Make default:
<Property Id="LAUNCHAPPONEXIT" Value="1" />
Then correct the conditions (corrected with sascha's comment):
<Publish Dialog="ExitDialogEx" Control="Finish" Order="1" Event="DoAction" Value="StartConfigManagerOnExit">LAUNCHAPPONEXIT</Publish>
<Publish Dialog="ExitDialogEx" Control="Finish" Order="1" Event="DoAction" Value="StartUpgradeConfigOnExit">NOT LAUNCHAPPONEXIT</Publish>
A checkbox has no value at all when unchecked, so rather than use the 1/0 notation you can simply use
LAUNCHAPPONEXIT
and
Not LAUNCHAPPONEXIT
You need to add initialize custom action for your property,
<CustomAction ID="InitLAUNCHAPPONEXIT"
Property="LAUNCHAPPONEXIT"
Value="0"
Return="check"/>
and then add it to InstallUISequence before show exit dialog, or simply add your property to product <Property Id="LAUNCHAPPONEXIT" Value="0" />.