Wix Run App After Install Not Working - wix

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>

Related

Why file get overwritten when KeyPath is set in Wix

The snippet of Files.wxs generated by heat:
<?xml version="1.0" encoding="utf-8"?>
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Directory Id="dirF5D9BDF13CBC346EDDFD6D0959FFB838" Name="config">
<Component Id="cmp0CBEDCE6B62E5666B3362D0EB41267BC" Guid="*">
<File Id="fil73D1987B7864F07C97735D7E40243AB2" KeyPath="yes"
Source="$(var.App.TargetDir)\config\accounts-example.ini" />
</Component>
</Component>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="Binaries">
<ComponentRef Id="cmp0CBEDCE6B62E5666B3362D0EB41267BC" />
</ComponentGroup>
</Fragment>
</Wix>
Product.wxs:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="xxx" Language="2052" Version="$(var.ProductVersion)" Manufacturer="xxx"
UpgradeCode="425BDA6F-31B8-47AD-88D8-4B2DBE394XXX">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="New Version [ProductName] has been installed。" />
<MediaTemplate EmbedCab="yes" />
<WixVariable Id="WixUILicenseRtf" Value="./License.rtf" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="MANUFACTURERFOLDER" Name="!(bind.property.Manufacturer)">
<Directory Id="INSTALLFOLDER" Name="!(bind.property.ProductName)" />
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="!(bind.property.ProductName)" />
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="XXX_Installer" Level="1">
<ComponentGroupRef Id="Binaries" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
<ComponentRef Id="RegistryEntries" />
</Feature>
<UIRef Id="WixUI_ErrorProgressText" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="WixUI_InstallDir" />
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="E1F61345-CC60-40FE-8FC4-FBE1598F8XXX">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="!(bind.property.ProductName)"
Description="!(bind.property.ProductName)"
Target="[INSTALLFOLDER]XXX_App.exe"
WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Microsoft\!(bind.property.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="BEDF111F-0889-4317-8E67-41425F00CXXX">
<Shortcut Id="ApplicationDesktopShortcut"
Name="!(bind.property.ProductName)"
Description="!(bind.property.ProductName)"
Target="[INSTALLFOLDER]XXX_App.exe"
WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Microsoft\!(bind.property.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="0D919675-E219-43EA-AAB3-E6F81A013XXX">
<RegistryKey Root="HKCU"
Key="Software\Microsoft\Windows\CurrentVersion\Run">
<RegistryValue Name="!(bind.property.ProductName)"
Type="string"
Value="[INSTALLFOLDER]XXX_App.exe"/>
</RegistryKey>
</Component>
</DirectoryRef>
<UI>
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="启动!(bind.property.ProductName)" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<Property Id="WixShellExecTarget" Value="[INSTALLFOLDER]XXX_App.exe" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
</Product>
</Wix>
Every time I install a new version, it overwrites the existing file accounts-example.ini.
The overwrite behavior is expected for accounts-example.ini, but I will have another file user.db do not want to be overwritten.
It says if KeyPath is set to 'yes' then it doesn't overwrite the existing file, isn't it? How could I config Wix to overwrite one file and not overwirte another?
Some articles about KeyPath:
what-is-the-wix-keypath-attribute
copy-if-not-exist-in-wix
If you are doing this with a majorupgrade element you need to tell us where it's scheduled. If it's "early" (such as afterInstallInitialize) then everything will be uninstalled first, and then the new upgrade installed, and every file that was installed will be from the new upgrade. If it's sequenced "late" (such as afterInstallExecute) then the overwrite rules apply (such as this https://msdn.microsoft.com/en-us/library/windows/desktop) and that's because the upgrade basically installs each file over the existing files.
Note that the WiX default for the MajorUpgrade schedule is afterInstallValidate, so as I described (and as the WiX documentation says) the entire older product will be uninstalled first (obviously removing all files) then all the new files will be installed.
See schedule here:
http://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html
The explanation at the WiX keypath link leaves a lot to be desired. It is not really true to say that if the component is present none of its resources will be installed. It's not clear to me what that is intended to mean because the overwrite rules will be applied.
As far as your data files are concerned, they will not be overwritten by an incoming file if they have been updated since they were installed. So it's likely that your ini file is being overwritten because it hasn't been changed. If your db has been updated then it won't be replaced, but, again, this is overwrite rules when your major upgrade is "late" (or it's a patch).

WIX Create All Users Shortcut without Registry Key

I have a WIX file which i'm using to to install an app and create two short cuts. One in all users start menu and one in the desktop.
Since it creates it's stuff in all users I thought that you didn't need to have a reg key.
But without it it complains.
with
error LGHT0204: ICE38: Component ProgramMenuAppFolder installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file.
With HKLM however it also complains that the
LGHT0204: ICE38: Component ProgramMenuAppFolder installs to user profile. It's KeyPath registry key must fall under HKCU.
Even though it's installing to the all users and so shouldn't be installing to the user profile.
Any suggestions?
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="$(var.PublisherSimple) $(var.AppName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Publisher)" UpgradeCode="$(var.ProductUpgradeCode)">
<Package
Description="$(var.PublisherSimple) $(var.AppName) $(var.ProductVersion)"
InstallerVersion="200" Compressed="yes"
InstallScope="perMachine"
/>
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate CompressionLevel="none" />
<Feature Id="ProductFeature" Title="$(var.PublisherSimple) $(var.AppName) $(var.ProductVersion)" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ProgramMenuDir"/>
<ComponentRef Id="ProgramMenuAppFolder"/>
</Feature>
<UI>
<UIRef Id="WixUI_InstallDir" /> <!-- actually uses but that just skips the licence page <UIRef Id="WixUI_InstallDir_Custom" />-->
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<!--<Property Id="WixAppFolder" Value="WixPerMachineFolder" />-->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.AppName)" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<Property Id="WixShellExecTarget" Value="[#MVTestApp.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="PublisherDirectory" Name="MV">
<Directory Id="INSTALLFOLDER" Name="MV Test App"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="MV" >
<Directory Id="ProgramMenuAppFolder" Name="MV Test App Folder">
<Component Id="ProgramMenuAppFolder" Guid="3ebfd81d-08b2-4bcf-8c90-e84241a58976">
<RemoveFolder Id="ProgramMenuAppFolder" On="uninstall" />
<!--<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" />-->
</Component>
</Directory>
<Component Id="ProgramMenuDir" Guid="f1cf94bf-5e5a-4c60-8729-65bdf1cb9244">
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
<!--<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]Start" Type="string" Value="" KeyPath="yes" />-->
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents">
<Component Id="MVTestApp.Exe" Directory="INSTALLFOLDER" Guid="*" Win64="no">
<File Id="MVTestApp.Exe" KeyPath="yes" Source="MVTestApp.Exe" />
<Shortcut Id="startmenuShortCut" Directory="ProgramMenuAppFolder" Name="MV Test App Short Start" WorkingDirectory="INSTALLFOLDER" Advertise="yes" />
<Shortcut Id="desktopShortCut" Directory="DesktopFolder" Name="MV Test App Short Desk" WorkingDirectory="INSTALLFOLDER" Advertise="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
This is a similar problem as Install optional desktop shortcut for all users

Uninstall of wix installer seems to do a repair instead of uninstalling

I have a project which uses wix to generate an install package. The install works fine, but when one tries to uninstall the project, everything looks nice - but after the unistall finishes the product ist still there (still functioning). The entry in add/remove programs disappears when uninstalled from there, but comes back after a refresh (F5). Testers have found that everything looks like the uninstall actually does a repair.
What are we doing wrong (the project otherwise only generates further component fragment files with "heat" (with HeatDirectory-Entries in the wixproj), and defines a few preprocessor variables)?
Here's the product.wxs. Sorry, I know thats a lot of code, but I do not know what I can safely omit to find the problem...:
<?xml version="1.0" encoding="UTF-8"?>
<?define ProductVersion=1.1.0.0?>
<?define UpgradeCode=$(var.UpdateCode)?>
<?define ProductName=$(var.PV) Name?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="xyz" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />
<SetProperty Id="REINSTALL" Value="ALL" After="FindRelatedProducts" >Installed AND Remove<>"ALL"</SetProperty>
<SetProperty Id="REINSTALLMODE" Value="vamus" After="FindRelatedProducts">Installed AND Remove<>"ALL"</SetProperty>
<MajorUpgrade DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="XY Installer" Level="1" ConfigurableDirectory="INSTALLLOCATION">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="DesktopShortcutComponentGroup"/>
<ComponentGroupRef Id="StartmenuShortcuts"/>
</Feature>
<CustomAction Id="RestoreDatabase" Directory="INSTALLLOCATION" ExeCommand="[INSTALLLOCATION]initial_db\BURestore.exe $(var.Sport)_$(var.Project) D:\$(var.Sport)\initial_db\db.bak" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />
<CustomAction Id="RenameFormatFilesFolder" Directory="LISTTOOLLOCATION" ExeCommand="cmd /c "mv FormatFiles fmt"" Return="ignore" Impersonate="yes"></CustomAction>
<InstallExecuteSequence>
<Custom Action="RestoreDatabase" Before="InstallFinalize">NOT REMOVE</Custom>
<Custom Action="RenameFormatFilesFolder" After="InstallFinalize">NOT REMOVE</Custom>
</InstallExecuteSequence>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"/>
<UI>
<UIRef Id="WixUI_InstallDir"/>
<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>
</UI>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ROOTDIR" Name="D"/>
<Directory Id="INSTALLLOCATION" Name="$(var.PV)">
<Directory Id="CONF" Name="conf">
<Directory Id="LISTTOOLLOCATION" Name="PRINT"></Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder" />
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuSubfolder" Name="ST">
<Directory Id="ApplicationFolder" Name="$(var.ProductName)" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLLOCATION">
<ComponentGroupRef Id="RootFiles" />
<ComponentGroupRef Id="ListToolFiles" />
<ComponentGroupRef Id="inis" />
</ComponentGroup>
<ComponentGroup Id="DesktopShortcutComponentGroup">
<Component Id="DesktopShortcutComponent" Guid="{C54B....}" Directory="DesktopFolder">
<Shortcut Id="ApplicationDesktopShortcut"
Name="$(var.ProductName)"
Description="$(var.ProductName) Application"
Target="[INSTALLLOCATION]RO.exe"
WorkingDirectory="INSTALLLOCATION"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\ST\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</ComponentGroup>
<ComponentGroup Id="StartmenuShortcuts" Directory="ApplicationFolder">
<Component Id="StartmenuShortcutComp" Guid="{ACD9...}">
<Shortcut Id="StartmenuShortcut" Name="$(var.ProductName)" Description="$(var.ProductName) Application" Target="[INSTALLLOCATION]RO.exe" WorkingDirectory="INSTALLLOCATION" />
<Shortcut Id="UninstallProduct" Name="Uninstall $(var.ProductName)" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" Description="Uninstalls $(var.ProductName)" />
<RemoveFolder Id="RemoveProgramMenuSubfolder" Directory="ProgramMenuSubfolder" On="uninstall"/>
<RemoveFolder Id="RemoveApplicationFolder" Directory="ApplicationFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\ST\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
The below two lines are making this issue.
<SetProperty Id="REINSTALL" Value="ALL" After="FindRelatedProducts" >Installed AND Remove<>"ALL"</SetProperty>
<SetProperty Id="REINSTALLMODE" Value="vamus" After="FindRelatedProducts">Installed AND Remove<>"ALL"</SetProperty>
That condition become true because Remove will be set ALL in Uninstall after InstallValidate action in Install execute sequence. Please check below link for more details.
https://msdn.microsoft.com/en-us/library/aa368013(v=vs.85).aspx

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>

How upgrade "secondary" executable using Wix?

I have msi setup written in Wix 3. Nothing too fancy, couple executables + some registry manipulations.
We have 2 executables, the main application and watch dog application that is always running(it's started once user logs in).
I've released new version of our software, in wix we specify to upgrade without uninstalling first. When new version msi is ran, it upgrades main application but watchdog application is not upgraded(even if it's not running, so it's not "in-use" problem)
I pasted below my wxs file, hopefully you can help me spot the problem.
Thanks a lot in advance,
Jack
This is the wxs file:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include Properties.wxi?>
<Product Id="$(var.ProductCode)" Name="$(var.Title)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package Description="$(var.ProductName)" Comments="$(var.ProductName)" InstallerVersion="200" Compressed="yes" />
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND' Minimum='$(var.ProductVersion)' IncludeMinimum='no' />
<UpgradeVersion OnlyDetect="no" Property="PREVIOUSFOUND" Minimum="0.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" />
</Upgrade>
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" CompressionLevel="high"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="ApplicationRootFolder" Name="$(var.ProductName)">
<Component Id="MyAppComponent" Guid="6657828D-0D3F-43A6-A2CB-375BFBB8A412">
<RemoveFolder Id="ApplicationRootFolder" On="uninstall" />
<File Id="MyAppMain" Name="MyApp.exe" Source="..\Release\MyApp.exe"/>
<File Id="FirstRunApp" Name="FirstRunApp.exe" Source="..\Release\FirstRunApp.exe"/>
<File Id="MyAppWatchDog" Name="MyAppWatchDog.exe" Source="..\Release\MyAppWatchDog.exe"/>
<!--File Id="CheckSniffer" Name="CheckSniffer.exe" Source="..\Release\CheckSniffer.exe"/-->
<File Id="License" Name="License.rtf" Source="License.rtf"/>
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" >
<Component Id="DesktopShortcuts" Guid="5567ED7E-03F8-4AB8-AFB5-F8074F4ED1B5">
<RegistryValue Id="RegShortcutDesktop" Root="HKCU" Key="Software\$(var.ProductName)" Name="DesktopSC" Value="1" Type="integer" KeyPath="yes" />
<Shortcut Id="DesktopShortcut" Name="$(var.ProductName)" Directory="DesktopFolder" Description="$(var.ProductName)" Target="[ApplicationRootFolder]$(var.Name).exe" Icon="Icon.exe" WorkingDirectory="ApplicationRootFolder" />
</Component>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProjectMenuFolder" Name="$(var.ProductName)">
<Component Id="StartMenuShortcuts" Guid="5567ED7E-03F8-4AB8-AFB5-F8074F4ED1B4">
<RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Type="string" Value="[ApplicationRootFolder]" Name="InstallPath"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\Run" Type="string" Value="[#MyAppWatchDog]" Name="MyAppWatchdog"/>
<RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Type="string" Value="" />
<Shortcut Id="ProgramMenuShortcut" Name="$(var.ProductName)" Description="$(var.ProductName)" Target="[ApplicationRootFolder]$(var.Name).exe" Icon="Icon.exe" WorkingDirectory="ApplicationRootFolder" />
<Shortcut Id="UninstallProduct" Name="Uninstall" Description="Uninstalls the $(var.ProductName)" Target="[System64Folder]msiexec.exe" Arguments="/x {$(var.ProductCode)}" />
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
<RemoveRegistryKey Root="HKCU" Key="Software\$(var.ProductName)" Action="removeOnUninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Title="$(var.Name)" Level="1">
<ComponentRef Id="MyAppComponent" />
<ComponentRef Id="StartMenuShortcuts" />
<ComponentRef Id="DesktopShortcuts" />
</Feature>
<Property Id="SEARCHWINPCAP">
<RegistrySearch Id="RegistrySearch" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" Name="VersionMajor" Type="raw"/>
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="ApplicationRootFolder"/>
<Property Id="PRODUCTNAME" Value="$(var.ProductName)"/>
<!--Property Id="SNIFFER_CHECK_RESULT" Value="0"/-->
<WixVariable Id="WixUIBannerBmp" Value="logo.JPG" />
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.Title)" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<Property Id="WixShellExecTarget" Value="[#MyAppMain]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<CustomAction Id="SetLaunchWatchDogTarget" Property="WixShellExecTarget" Value="[#MyAppWatchDog]" />
<CustomAction Id="LaunchWatchDog" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<Binary Id="BinBrowseForFile" SourceFile="tools\WinPcap_4_1_2.exe"/>
<CustomAction Id='LaunchWinPcapSetup' BinaryKey="BinBrowseForFile" ExeCommand="/Install" Execute="deferred" Impersonate="no" Return="check"/>
<CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.'/>
<Property Id="CUSTOM_TITLE" Value="$(var.Title) Setup" />
<CustomAction Id='SetRepearTitle' Property='CUSTOM_TITLE' Value='Repair $(var.Title)'/>
<CustomAction Id='SetRemoveTitle' Property='CUSTOM_TITLE' Value='Remove $(var.Title)'/>
<!--debug-->
<Binary Id="BinCustomAction" SourceFile="bin\release\CustomActions.CA.dll"/>
<!--Binary Id="BinCheckSniffer" SourceFile="..\Release\CheckSniffer.exe"/-->
<Property Id="USER_GUID_PATH" Value="Software\Licenses"/>
<Property Id="USER_GUID" />
<Property Id="DUBUG_URL" Value="http://debug.myapp.com/service/"/>
<Property Id="DUBUG_STATE" Value="STARTED" />
<CustomAction Id='SendRequest' BinaryKey="BinCustomAction" DllEntry="SendRequest" Execute="immediate" Return="check" />
<CustomAction Id='SendRequest_WinPcap_Start' BinaryKey="BinCustomAction" DllEntry="SendRequest" Execute="immediate" Return="check" />
<CustomAction Id='SendRequest_WinPcap_Finish' BinaryKey="BinCustomAction" DllEntry="SendRequest" Execute="immediate" Return="check" />
<CustomAction Id='LicenseAgreement_Next' Property='DUBUG_STATE' Value='LICENSE_AGREED' />
<CustomAction Id='InstallDirDlg_Install' Property='DUBUG_STATE' Value='INSTALL' />
<CustomAction Id='Exit_Finish' Property='DUBUG_STATE' Value='FINISH' />
<CustomAction Id='WinPcap_Start' Property='DUBUG_STATE' Value='WINPCAP_STARTED' />
<CustomAction Id='WinPcap_Finish' Property='DUBUG_STATE' Value='WINPCAP_FINISHED' />
<CustomAction Id='Traffic_Failed' Property='DUBUG_STATE' Value='TRAFFIC_FAILED' />
<CustomAction Id='Traffic_Uninstalled' Property='DUBUG_STATE' Value='UNINSTALLED' />
<CustomAction Id='Shell_icacls' Directory='ApplicationRootFolder' ExeCommand='icacls FirstRunApp.exe /setintegritylevel Low' Return="ignore" Execute="commit" Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action='NoDowngrade' After='FindRelatedProducts'>NEWERFOUND</Custom>
<Custom Action="WinPcap_Start" Before="SendRequest_WinPcap_Start" ><![CDATA[SEARCHWINPCAP < "4" AND NOT Installed]]></Custom>
<Custom Action="SendRequest_WinPcap_Start" Before="LaunchWinPcapSetup"><![CDATA[SEARCHWINPCAP < "4" AND NOT Installed]]></Custom>
<Custom Action="LaunchWinPcapSetup" Before="InstallFiles"><![CDATA[SEARCHWINPCAP < "4" AND NOT Installed]]></Custom>
<!-- disable currently Custom Action="CheckSniffer" Before="Shell_icacls">NOT Installed</Custom-->
<Custom Action="Shell_icacls" Before="InstallFinalize"><![CDATA[VersionNT >= 600 AND NOT Installed]]></Custom>
<!--Custom Action="Shell_RunWatchDog" After="InstallFinalize"><![CDATA[NOT Installed]]></Custom-->
<RemoveExistingProducts After="InstallFinalize"></RemoveExistingProducts>
<Custom Action="Traffic_Uninstalled" Before='SendRequest'>Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
<Custom Action="SendRequest" After='InstallFinalize'>Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
<UI />
<UIRef Id="WixUI_Wizard" />
<PropertyRef Id="NETFRAMEWORK35" />
<Condition Message="This application requires .NET Framework 3.5 SP1.">Installed OR NETFRAMEWORK35</Condition>
<Icon Id="Icon.exe" SourceFile="..\MyApp\Resources\icon_main.ico" />
</Product>
</Wix>
The first thing that jumps at me from your Wix code is the fact that you are shipping all executables inside a single component but there is no KeyPath for the component. This is a very bad idea! It will definitely result in many servicing issues, such as the one you're experiencing with your watchdog.exe not updating.
Windows Installer considers a component the smallest installation unit. Furthermore, the Windows Installer will only look at the KeyPath to decide whether the component exists (or needs to be updated, etc.) Since the "MyAppComponent" has no keypath, the WI will default to using the Directory as your keypath. This means that during an upgrade, if WI finds your directory, it will assume the component is already installed and will not update any of the files in the component.
The rule of thumb to follow is that any .exe or .dll file must be the only file in the component, and it should also be the keypath for your component. I go as far as creating a component for each individual file in my setups, which will avoid many headaches in the future. Try replacing the MyAppComponent with these components instead:
<Directory Id="ApplicationRootFolder" Name="$(var.ProductName)">
<Component Id="MyApp.exe" Guid="INSERT_GUID_HERE">
<File Id="MyApp.exe" Name="MyApp.exe" Source="..\Release\MyApp.exe" KeyPath="yes"/>
</Component>
<Component Id="FirstRunApp.exe" Guid="INSERT_GUID_HERE">
<File Id="FirstRunApp.exe" Name="FirstRunApp.exe" Source="..\Release\FirstRunApp.exe" KeyPath="yes"/>
</Component>
<Component Id="MyAppWatchDog.exe" Guid="INSERT_GUID_HERE">
<File Id="MyAppWatchDog.exe" Name="MyAppWatchDog.exe" Source="..\Release\MyAppWatchDog.exe" KeyPath="yes"/>
</Component>
<Component Id="CheckSniffer.exe" Guid="INSERT_GUID_HERE">
<File Id="CheckSniffer.exe" Name="CheckSniffer.exe" Source="..\Release\CheckSniffer.exe" KeyPath="yes"/>
</Component>
<Component Id="License.rtf" Guid="INSERT_GUID_HERE">
<File Id="License.rtf" Name="License.rtf" Source="License.rtf" KeyPath="yes"/>
</Component>
</Directory>
This should resolve your updating issues. You may also want to conisder splitting your shortcut components into one shortcut per component, and setting an HKCU value as the keypath for each component.
Thanks to everyone trying to help.
#Cosmin Pirvu was the one with correct answer. We didn't update the version of watchdog application and thus it was not being installed.
Thank you