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

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" />

Related

WiX service don't start: service failed to start verify that you have sufficient privileges

I have a java application. I have made an scansol-agent-app.exe file from that i need to make an installer with WiX. Below there is a code of scansol-agent.wxs file. I need to install this app as windows service. Servise installs well, but don't starts. Windows shows me an error: “Service failed to start - Verify that you have sufficient privileges to start system services”
I tried all variants that could find, but no any results. How can i start this service?
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
UpgradeCode="{EB6B8302-C06E-4bec-ADAC-932C68A3A98D}"
Name="Scansol Agent Application Service"
Version="0.0.1"
Manufacturer="ScienceSoft"
Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" Manufacturer="ScienceSoft"/>
<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
<Property Id="WHSLogo">1</Property>
<WixVariable Id="WixUILicenseRtf" Value="license.rtf" />
<UI>
<Property Id="ApplicationFolderName" Value="WiX Demo" />
<Property Id="WixAppFolder" Value="WiXxperMachineFolder" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
<!--<Property Id="DefaultUIFont">DlgFont8</Property>-->
<TextStyle Id="DlgFont8" FaceName="Tahoma" Size="8" />
<TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" />
<Dialog Id="InstallDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\DlgTitleFont}Ready to Install</Text>
</Control>
<Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17"
Default="yes" Text="Install">
<Publish Event="EndDialog" Value="Return" />
</Control>
</Dialog>
</UI>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="INSTALLDIR" Name="ScansolAgent">
<Component Id="ApplicationServiceInstall" Guid="{908B7199-DE2A-4dc6-A8D0-27A5AE444FEA}">
<File Id='ApplicationFile1' Source="scansol-agent-app.exe" DiskId='1' KeyPath='yes' Vital='yes'/>
<File Id="ApplicationFile2" Source="config.cfg" DiskId='1' KeyPath='no' Vital='yes'/>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="ScansolAgentService"
DisplayName="Scansol Agent Application Service"
Description="File Monitoring and Loading to server"
Start="auto"
Account="LocalSystem"
ErrorControl="ignore"
Interactive="no"
>
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="ScansolAgentService" Wait="yes" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1" Title="ScansolAgentAppService">
<ComponentRef Id="ApplicationServiceInstall" />
</Feature>
</Product>
</Wix>
The reasons could be many and vast majority of those were addressed, however, I had a case that none of the answers or suggestions were applicable to it. At the end I found the reason for my case: in the ServiceInstall tag there is an attribute named Account, which in my case was LocalService, however, in my project for the Windows Service, in the generated file I assigned for my service the account to be LocalSystem. So if the service account set in the windows service project does not match to what you later specify in your WiX source file under the ServiceInstall's Account attribute, then the Windows Installer will successfully install your service, however, will fail on starting it. Conclusion, make sure the service accounts match at both places. And again, this might not be your case, but is worth to double check.
Please see this answer: https://stackoverflow.com/a/65342252/6657445. For this case, because this is not a domain or local user account, try flipping "Interactive" to "yes". I have other services installed this way without issue.

Wix Run App After Install Not Working

What is wrong in my code. I can't run app after I check"EXITDIALOGOPTIONALCHECKBOX" on "ExitDialog".
<UI>
<UIRef Id='WixUI_Minimal'/>
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchInstalledExe">LAUNCH_APP_ON_EXIT</Publish>
</UI>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="APPLICATIONROOTDIRECTORY">
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" />
</Directory>
<Directory Id="DesktopFolder" />
</Directory>
</Directory>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="Test.exe" Guid="EF2B3E63-B797-47E6-A1AD-8221F13B6959">
<File Id="Test.exe" Source="ApplicationFiles\Test.exe" KeyPath="yes" Checksum="yes"/>
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="Test.exe" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationDesktopShortcut" />
</Feature>
<InstallExecuteSequence>
<Custom Action='ChangeDir' After='CostFinalize' >NOT Installed</Custom>
</InstallExecuteSequence>
<Fragment>
<CustomAction Id="ChangeDir" Directory="APPLICATIONROOTDIRECTORY" Value="C:\\SampleFolder\" />
<CustomAction Id="LaunchApplication" FileKey="Test.exe" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
<CustomAction Id="LaunchInstalledExe"
FileKey="Test.exe"
ExeCommand=""
Execute="immediate"
Impersonate="yes"
Return="asyncNoWait" >
</CustomAction>
</Fragment>
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="FBE47082-5FC5-4861-B113-96BA9D30821F">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="Test"
Description="opis"
Icon="logo.ico"
Target="[APPLICATIONROOTDIRECTORY]\Test.exe"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Test" Name="Test" Type="integer" Value="1" KeyPath="yes"/>
<!-- Uninstall Shortcut-->
<Shortcut Id="UninstallProduct"
Name="Uninstall Test"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode]"
Description="Uninstall Test" />
</Component>
</DirectoryRef>
<!-- desktop shortcut-->
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationDesktopShortcut" Guid="5c9b9050-3846-49c3-8484-910f49d4eddf">
<Shortcut Id="desktopSC" Target="[APPLICATIONROOTDIRECTORY]\Test.exe"
Directory="DesktopFolder" Name="Test" IconIndex="0" WorkingDirectory="APPLICATIONFOLDER" Icon="logo.ico" Advertise="no" />
<RemoveFolder Id="ApplicationDesktopFolder" Directory="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="SOFTWARE\Test" Name="Test" Value="1" Type="integer" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
When I rem line with 'Custom Action='ChangeDir'' app will lunch. I really need this Custom Action becouse in other custom action I run (below code) to change 'APPLICATIONROOTDIRECTORY'
<CustomAction Id="LicenseInfoCustomAction" BinaryKey="CustomActionBinary" DllEntry="ShowLicenseInfo" Execute="immediate" Return="check" HideTarget="yes" />
<Binary Id="CustomActionBinary" SourceFile="$(var.MyCustomAction.TargetDir)$(var.MyCustomAction.TargetName).CA.dll"/>
.
Please help.
Update:
Finally I find solution in this documentation:
wix documentation
App starts even with administrator privileges.
From the Dizzy Monkey
Conditionally launching the application after installation
There are two ways to add a checkbox to the final page of an installation in order to conditionally launch an application. The first is supported in WiX 3 without needing any changes to the original dialogs, but it has a major limitation.
The final dialog box (ExitDialog) has an optional checkbox that can be displayed, and the property tied to this checkbox can be used to conditionally launch the application. The following entries in the setup file will add this checkbox
<CustomAction Id="StartAppOnExit" FileKey="YourAppExeId" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch Sample App 1.0 when setup exits." />
<UI>
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="StartAppOnExit">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT</Publish>
</UI>
After looking at your code, you seem to have two custom actions that start your Application, you will only need one (LaunchApplication).
In this part
<UI>
<UIRef Id='WixUI_Minimal'/>
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchInstalledExe">LAUNCH_APP_ON_EXIT</Publish>
</UI>
Change the Publish dialog for:
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT</Publish>

Wix uninstall not removing files, always assumes program files\myApp folder

I'm having a problem with the Wix installer and don't know what specifically I'm missing.
I have enabled the dialog to allow user pick their own installation folder over the default of
If I run the install and just leave the default of "Program Files\MyApp", the app installs no problem. If I then uninstall, all the files and folders properly get deleted.
If I run the install and change the default to something like c:\TestFolder\MyApp, it installs no problem to that location and includes the subfolder for the Java64bit and Java64bit/lib folders with respective content.
Then, if I immediately do an uninstall, it properly removes the Java stuff completely, but leaves all the files within the c:\TestFolder\MyApp root.
Looking into the registry after install, it DOES show the proper install directory location. What else can I provide to help resolve this.
Here is the full (with GUIDs removed) install of different files
File for the main (sample) product
<?xml version="1.0" encoding="utf-32BE"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Name="AMyApp"
Manufacturer="Testing"
Language="1033"
Version="1.0.1.0"
Id="*"
UpgradeCode="{GUID1}" >
<?include AMyApp_Define_Paths.wxi ?>
<Package
Id="*"
InstallerVersion="200"
Platform="x64"
Compressed="yes"
Languages="1033"
SummaryCodepage="1252"
Comments="AMyApp Package Comments area"
Description ="AMyApp"
InstallScope="perMachine" />
<MajorUpgrade
AllowDowngrades="no"
AllowSameVersionUpgrades="yes"
DowngradeErrorMessage="A newer version of AMyApp is already installed." />
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="{GUID1}">
<UpgradeVersion
Minimum="4.0.0.0" Maximum="99.0.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<Media Id="1"
Cabinet="AMyApp.cab"
EmbedCab="yes" />
<WixVariable Id="ALLUSERS" Value="2" />
<WixVariable Id="MSIINSTALLPERUSER" Value="" />
<!-- see if location from a previously installed instance. -->
<Property Id="INSTALLDIR" >
<RegistrySearch Id="AMYAPP" Type="raw"
Root="HKLM" Key="SOFTWARE\AMYAPP" Name="InstallDir" />
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<!-- Search registry for previous installed location -->
<Property Id="PREVIOUSINSTALLFOLDER">
<RegistrySearch Id="GetPreviousInstallFolder" Root="HKLM"
Key="SOFTWARE\AMYAPP" Name="INSTALLDIR" Type="raw" />
</Property>
<CustomAction Id="SetINSTALLDIR" Property="INSTALLDIR"
Value="[PREVIOUSINSTALLFOLDER]" Execute="firstSequence" />
<CustomAction Id="SetWIXUI_INSTALLDIR" Property="WIXUI_INSTALLDIR"
Value="[PREVIOUSINSTALLFOLDER]" Execute="firstSequence" />
<InstallExecuteSequence>
<Custom Action="SetINSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
<Custom Action="SetWIXUI_INSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="SetINSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
<Custom Action="SetWIXUI_INSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
</InstallUISequence>
<Directory Id="TARGETDIR" Name="SourceDir" >
<!-- The directories "DesktopFolder", "FontsFolder", "ProgramFilesFolder"
are all pre-defined common names via the installer and reference the
actual windows locations respectively -->
<Directory Id="DesktopFolder" />
<Directory Id="FontsFolder" />
<Directory Id="ProgramFiles64Folder" >
<!-- The "ID" is the name internally that refers to the folder when
trying to install files, etc... the "Name" is what the actual name
will be at actual install time as viewed by Windows Explorer -->
<Directory Id="INSTALLDIR" Name="AMYAPP" >
<Component Id="C_HKLM_AMyAppUsage" Guid="{GUID2}">
<RegistryKey Root="HKLM" Key="SOFTWARE\AMyApp" >
<RegistryValue Name="IsSomeKey" Type="string" Value="YES" KeyPath="yes" />
</RegistryKey>
</Component>
<Directory Id="Java64BitDIR" Name="Java64Bit" >
<Directory Id="Java64BitLibDIR" Name="Lib" />
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="AMyApp_Features"
Title="AMyApp (Wix Testing)"
Level="1"
ConfigurableDirectory="INSTALLDIR" >
<ComponentRef Id="C_HKLM_AMyAppUsage" />
<ComponentRef Id="AMyApp_CORE" />
<ComponentRef Id="AMyApp_Shortcuts" />
<ComponentRef Id="JAVA64BIT_Support" />
<ComponentRef Id="JAVA64BITLIB_Support" />
</Feature>
<UI>
<UIRef Id="WixUI_InstallDir" />
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Next"
Event="NewDialog"
Value="VerifyReadyDlg"
Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
</UI>
<Property Id="LAUNCHAPPONEXIT" Value="1" />
</Product>
</Wix>
Fragment file for the Java Subfolders sample
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<?include AMyApp_Define_Paths.wxi ?>
<DirectoryRef Id="Java64BitDIR">
<Component Id="JAVA64BIT_Support" Guid="{GUID1a}">
<File Id="_64_javax.comm.properties" Source="$(var.Path_Java64Bit)\javax.comm.properties" />
</Component>
</DirectoryRef>
<DirectoryRef Id="Java64BitLibDIR">
<Component Id="JAVA64BITLIB_Support" Guid="{GUID2a}">
<File Id="_64_HardwireDriver.jar" Source="$(var.Path_Java64BitLib)\HardwireDriver.jar" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
Fragment file for the common stuff installed at root folder
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" >
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Component Id="AMyApp_CORE" Guid="{GUID1c}" Win64="yes">
<?include AMyApp_Define_Paths.wxi ?>
<RegistryKey
Root="HKLM"
Key="SOFTWARE\AMyApp"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes" >
<RegistryValue Type="string" Name="InstallDir" Value="[INSTALLDIR]"/>
<RegistryValue Type="string" Name="MyAppContext" Value="Testing"/>
</RegistryKey>
<RemoveFile Id="RemoveAllMyAppFiles" Name="*.*" On="uninstall" />
<RemoveFolder Id="INSTALLDIR" On="uninstall" />
<File Id="MyApp.exe" Source="$(var.Path_MyAppReleaseFolder)\MyApp.exe" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
Here is a simplified work-around I came up with, but don't know why it does what it does under the hood, but works.
During the declaration of the <UI> segment, I just changed both "Welcome" and "MaintenanceWelcome" dialogs to both go to the "Install Directory" dialog. It apparently bypasses the route for "Repair" / "Uninstall" but WILL allow the installer to handle it's own delete of original and re-publish the new files from the installer.
<UI>
<UIRef Id="WixUI_InstallDir" />
<!--<Property Id="WixUI_Mode" Value="InstallDir" />-->
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<!-- Send the MAINTENANCE Dialog to the same Install Dir dialog -->
<Publish Dialog="MaintenanceWelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
...
</UI>

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 Error LGHT0130 In InstallScopeDlg when modifying Wix_Advanced UI

I am using WiX 3.6.
I am using the WIX_Advanced user interface and I want to replace the InstallScopeDlg with my own version (called InstallScopeDlgDsktp) which includes a checkbox for adding a Desktop shortcut.
When I do this, I take all the references to the old InstallScopeDlg in the WixUI_Advanced.wxs file, and override them in my main file to instead reference my custom InstallScopeDlgDsktp module.
However, when I try compiling, I get an error which seems to indicate there is a clash with a RadioButton table which means both my InstallScopeDlgDsktp and the original InstallScopeDlg must be adding a RadioButton based on the same property (WixAppFolder).
light Cryptobot.wixobj InstallScopeDlgDsktp.wixobj -ext WixUIExtension -out Cryptobot.msi
Microsoft (R) Windows Installer Xml Linker version 3.6.2221.0
<snip>wixlib\InstallScopeDlg.wxs(24): error LGHT0130 :
The primary key 'WixAppFolder/1' is duplicated in table 'RadioButton'. Please remove one of the entries or rename a part of the primary key to avoid the collision.
I can't seem to get around this. My question is, why is it even linking in the original InstallScopeDlg module when I am not even referencing it any more? How do I stop the original InstallScopeDlg from adding the RadioButton?
Code provided for reference:
Main WXS file (UI stuff is at the bottom - can see I replaced all instances of InstallScopeDlg with InstallScopeDlgDsktp):
<?xml version="1.0" encoding="windows-1252"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- Defines -->
<?define ProductName="Cryptobot" ?>
<?define ProductVersion="1.1.1" ?>
<Product Name="$(var.ProductName) $(var.ProductVersion)" Id="*"
UpgradeCode="MY-UPGRADE-GUID"
Language="1033" Codepage="1252" Version="$(var.ProductVersion)" Manufacturer="Crafted From Code">
<!-- The Package GUID must be changed EVERY timeyou build a new .msi. The asterisk makes this happen automatically. -->
<Package Id="*" Keywords="Installer"
Description="$(var.ProductName) $(var.ProductVersion) Setup"
Manufacturer="Crafted From Code"
InstallerVersion="200" Languages="1033" Compressed="yes" />
<Media Id="1" Cabinet="$(var.ProductName).cab" EmbedCab="yes" />
<!-- Components to install -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="CraftedFromCode" Name="Crafted From Code">
<Directory Id="APPLICATIONFOLDER" Name="$(var.ProductName)">
<Component Id="MainExecutable" Guid="MY-GUID">
<File Id="CryptobotEXE" Name="Cryptobot.exe" Source="..\Cryptobot\bin\Release\Cryptobot.exe" KeyPath="yes">
<Shortcut Id="CryptobotProgramMenuShortcut" Directory="ProgramMenuDir"
Name="$(var.ProductName)" Icon="Cryptobot.ico" IconIndex="0" Advertise="yes" />
<Shortcut Id="CryptobotDesktopShortcut" Directory="DesktopFolder"
Name="$(var.ProductName)" Icon="Cryptobot.ico" IconIndex="0" Advertise="yes" />
</File>
<RemoveFolder Id="APPLICATIONFOLDER" On="uninstall" />
</Component>
</Directory>
</Directory>
</Directory>
<!-- Start Menu Shortcut(s) -->
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="$(var.ProductName)">
<Component Id="ProgramMenuShortcut" Guid="MY-GUID" >
<RegistryValue Root="HKCU" Key="Software\Crafted From Code\Cryptobot" Name="installed" Type="integer" Value="1" KeyPath="yes" />
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
</Component>
</Directory>
</Directory>
<!-- Desktop Shortcut -->
<Directory Id="DesktopFolder">
<Component Id="DesktopShortcut" Guid="MY-GUID">
<Condition>INSTALLDESKTOPSHORTCUT</Condition>
<RegistryValue Root="HKCU" Key="Software\Crafted From Code\Cryptobot" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</Directory>
</Directory> <!-- End of TARGETDIR root directory -->
<Icon Id="Cryptobot.ico" SourceFile="Cryptobot.ico" />
<Feature Id="Complete" Level="1" Title="$(var.ProductName)"
Description="The complete package." Display="expand"
ConfigurableDirectory="APPLICATIONFOLDER">
<ComponentRef Id="MainExecutable" />
<ComponentRef Id="ProgramMenuShortcut" />
<ComponentRef Id="DesktopShortcut" />
</Feature>
<!-- Upgrade rules: If a newer version is found, don't allow installation of an older version (downgrading).
Otherwise, if an older version is already installed, remove it before installing the current version -->
<Upgrade Id="MY-UPGRADE-GUID">
<UpgradeVersion OnlyDetect="yes" Property="NEWERPRODUCTFOUND" Minimum="$(var.ProductVersion)" IncludeMinimum="no" />
<!-- Setting IncludeMaximum to yes generates a linker warning, but it means that we can install over the
same version without necessarily having to change the version number. -->
<UpgradeVersion OnlyDetect="no" Property="PREVIOUSVERSIONINSTALLED" Minimum="1.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="yes" />
</Upgrade>
<CustomAction Id='PreventDowngrading' Error='A newer version of $(var.ProductName) is already installed.' />
<InstallExecuteSequence>
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWERPRODUCTFOUND</Custom>
<RemoveExistingProducts After="InstallFinalize" />
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWERPRODUCTFOUND</Custom>
</InstallUISequence>
<!-- User Interface: Use the Advanced WiX interface, which will allow 1-click installation or
per user/per machine installation & install directory to be specified -->
<UIRef Id="WixUI_Advanced" />
<UIRef Id="WixUI_ErrorProgressText" />
<Property Id="ApplicationFolderName" Value="Crafted From Code\Cryptobot" />
<Property Id="WixAppFolder" Value="WixPerUserFolder" /> <!-- Defaults to install for all users -->
<Property Id="INSTALLDESKTOPSHORTCUT" Value="1" /> <!-- Support for a desktop shortcut -->
<!-- Add a checkbox to launch the application when the installer exits -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.ProductName) when setup exits." />
<!-- Have it ticked by default -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<CustomAction Id="StartAppOnExit" FileKey="CryptobotEXE" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
<UI Id="WixUI_AdvancedCrypto">
<UIRef Id="WixUI_Advanced" />
<DialogRef Id="InstallScopeDlgDsktp" />
<Publish Dialog="AdvancedWelcomeEulaDlg" Control="Advanced" Event="NewDialog" Value="InstallScopeDlgDsktp" Order="1">!(wix.WixUISupportPerMachine) AND !(wix.WixUISupportPerUser)</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Back" Event="NewDialog" Value="AdvancedWelcomeEulaDlg">1</Publish>
<!-- override default WixAppFolder of WixPerMachineFolder as standard user won't be shown the radio group to set WixAppFolder -->
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="WixAppFolder" Value="WixPerUserFolder" Order="1">!(wix.WixUISupportPerUser) AND NOT Privileged</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="ALLUSERS" Value="{}" Order="2">WixAppFolder = "WixPerUserFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="ALLUSERS" Value="1" Order="3">WixAppFolder = "WixPerMachineFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="APPLICATIONFOLDER" Value="[WixPerUserFolder]" Order="4">WixAppFolder = "WixPerUserFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="APPLICATIONFOLDER" Value="[WixPerMachineFolder]" Order="5">WixAppFolder = "WixPerMachineFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Event="NewDialog" Value="FeaturesDlg" Order="6">WixAppFolder = "WixPerUserFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="7">WixAppFolder = "WixPerMachineFolder"</Publish>
<Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlgDsktp">NOT Installed AND WixAppFolder = "WixPerUserFolder"</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlgDsktp">!(wix.WixUISupportPerUser)</Publish>
<!-- Add the check box for launching the app on completion -->
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="StartAppOnExit">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 AND NOT Installed</Publish>
</UI>
</Product>
</Wix>
And the InstallScopeDlgDsktp file is just a copy of InstallScopeDlg with a checkbox added and the name changed:
<snip>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="InstallScopeDlgDsktp" Width="370" Height="270" Title="!(loc.InstallScopeDlg_Title)" KeepModeless="yes">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallScopeDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="20" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgTitle)" />
<Control Id="BothScopes" Type="RadioButtonGroup" X="20" Y="55" Width="330" Height="120" Property="WixAppFolder" Hidden="yes">
<RadioButtonGroup Property="WixAppFolder">
<RadioButton Value="WixPerUserFolder" X="0" Y="0" Width="295" Height="16" Text="!(loc.InstallScopeDlgPerUser)" />
<RadioButton Value="WixPerMachineFolder" X="0" Y="60" Width="295" Height="16" Text="!(loc.InstallScopeDlgPerMachine)" />
</RadioButtonGroup>
<Condition Action="show">Privileged AND (!(wix.WixUISupportPerUser) AND !(wix.WixUISupportPerMachine))</Condition>
</Control>
<Control Id="PerUserDescription" Type="Text" X="33" Y="70" Width="300" Height="36" Hidden="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgPerUserDescription)">
<Condition Action="show">!(wix.WixUISupportPerUser)</Condition>
</Control>
<Control Id="NoPerUserDescription" Type="Text" X="33" Y="70" Width="300" Height="36" Hidden="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgNoPerUserDescription)">
<Condition Action="show">NOT !(wix.WixUISupportPerUser)</Condition>
</Control>
<Control Id="PerMachineDescription" Type="Text" X="33" Y="131" Width="300" Height="36" Hidden="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgPerMachineDescription)">
<Condition Action="show">Privileged</Condition>
</Control>
<Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="160" Width="290" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1" Text="Create a shortcut on the desktop." />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
You are still referencing the original WixUI_Advanced UI.
<UI Id="WixUI_AdvancedCrypto">
<UIRef Id="WixUI_Advanced" />
<DialogRef Id="InstallScopeDlgDsktp" />
This pulls in the InstallScopeDlg and will be causing your conflict. Take a copy of the WixUI_Advanced wxs from the wix sources and include in your project renaming it so that it doesn't conflict and then modify it to use your new InstallScopeDlgDsktop.