Wix launches application when uninstalling - wix

I have got a strange problem when using Wix to create a Windows Installer Setup for an application I'm working on.
Basically, when the application uninstalls it seems to be launching the application's executable before finalizing the uninstall. I am not sure why it is doing this as I am a newbie on Wix.
Here is the full Wix code, which I got from here.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define Product_Name="Orbit Invoice System"?>
<?define Product_Manufacturer="Orbit"?>
<?define Product_Name_Short="OIS"?>
<?define Product_Manufacturer_Short="Orbit"?>
<?define MainExeID="MainExeID"?>
<!--<?define Product_Version=!(bind.fileVersion.$(var.MainExeID))?>-->
<?define Product_Version=!(bind.assemblyVersion.$(var.MainExeID))?>
<?define SetupResourcesDir=$(var.SolutionDir)\icons\?>
<Product Id="*" Name="$(var.Product_Name)" Version="$(var.Product_Version)" Manufacturer="$(var.Product_Manufacturer)"
Language="1033"
UpgradeCode="F9A23E67-669B-40E5-9995-D8425D08F35F">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<!--Check for .Net Framework 3.5 SP 1-->
<PropertyRef Id='NETFRAMEWORK40FULL'/>
<Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
<MajorUpgrade DowngradeErrorMessage="A newer version of $(var.Product_Name) is already installed."
Schedule="afterInstallValidate"
/>
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="$(var.Product_Name) Setup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<!--Icon must be 16x16-->
<Icon Id="AddRemoveProgramsIcon" SourceFile="$(var.SetupResourcesDir)libra.ico"/>
<Property Id="ARPPRODUCTICON" Value="AddRemoveProgramsIcon" />
<!--<Property Id="ARPHELPLINK" Value="" />-->
<InstallExecuteSequence>
<Custom Action="CleanUpUserData" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE AND NOT REINSTALL</Custom>
<!--<Custom Action="LaunchApplication" Before="InstallFinalize" >UPGRADINGPRODUCTCODE OR REINSTALL OR NOT Installed</Custom>-->
</InstallExecuteSequence>
</Product>
<Fragment>
<CustomAction Id="CleanUpUserData" FileKey="$(var.MainExeID)" ExeCommand="cleanUpUserData" Execute="immediate" Impersonate="yes" Return="ignore"/>
<!--<CustomAction Id="LaunchApplication" FileKey="$(var.MainExeID)" ExeCommand="mustBeSomethingOrTheUpdateWillFailWithError2753" Execute="commit" Impersonate="yes" Return="asyncNoWait"/>-->
</Fragment>
<!--Directory general structure-->
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<!--Program Files-->
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="$(var.Product_Name)" />
</Directory>
<!--Startup Programs Menu-->
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="$(var.Product_Manufacturer)">
<Component Id="ProgramMenuDir" Guid="*" >
<Shortcut Id="UninstallProduct"
Name="Uninstall $(var.Product_Name)"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode]"
Description="Uninstalls $(var.Product_Name)" />
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\$(var.Product_Manufacturer_Short)\$(var.Product_Name_Short)' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<!--Desktop-->
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
</Fragment>
<!--Directory file structure-->
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="MainExecutable" Guid="*">
<File Id="$(var.MainExeID)" Name="$(var.Product_Name).exe" Source="$(var.Invoice.TargetPath)" DiskId="1" KeyPath="yes" Vital="yes"
Assembly=".net" AssemblyApplication="$(var.MainExeID)">
<Shortcut Id="MainExeDesktop" Directory="DesktopFolder" Name="$(var.Product_Name)" WorkingDirectory="INSTALLFOLDER"
Icon="MainExeIcon.exe"
Description="Launches the $(var.Product_Name) application" Advertise="yes" >
<Icon Id="MainExeIcon.exe" SourceFile="$(var.Invoice.TargetPath)"/>
</Shortcut>
<Shortcut Id="MainExeProgramMenu" Directory="ProgramMenuDir" Name="$(var.Product_Name)" WorkingDirectory="INSTALLFOLDER"
Icon="MainExeIcon.exe"
Description="Launches the $(var.Product_Name) application" Advertise="yes" />
<Shortcut Id="CleanUpLocalFiles" Directory="ProgramMenuDir" Name="CleanUp the Local Files" Arguments="cleanUpUserData" WorkingDirectory="INSTALLFOLDER"
Icon="MainExeIcon.exe"
Description="Cleanup all the downloaded files of the $(var.Product_Name) for the current user" Advertise="yes"/>
</File>
</Component>
<Component Id="MainExecutableConfig" Guid="BDFC3501-CB6A-4C75-A4AE-05C0F7FE2DC2">
<File Id="MainExeConfig" Name="$(var.Product_Name).exe.config" Source="$(var.Invoice.TargetPath).config" DiskId="1" KeyPath="yes" Vital="yes" />
<File Id="InvoiceConfig" Name="InvoiceConfiguration.dll" Source="$(var.Invoice.TargetDir)\InvoiceConfiguration.dll" DiskId="1" Vital="yes" />
<File Id="DocumentFormatOpenXml" Name="DocumentFormat.OpenXml.dll" Source="$(var.Invoice.TargetDir)\DocumentFormat.OpenXml.dll" DiskId="1" Vital="yes" />
<File Id="SalesInvoiceTemplate" Name="SalesInvoiceTemplate.docx" Source="$(var.Invoice.TargetDir)\SalesInvoiceTemplate.docx" DiskId="1" Vital="yes" />
</Component>
</DirectoryRef>
</Fragment>
<!--Components groups-->
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<ComponentRef Id="MainExecutable" />
<!--<ComponentRef Id="Dlls" />
<ComponentRef Id="LetterTemplates"/>-->
<ComponentRef Id="MainExecutableConfig" />
<ComponentRef Id="ProgramMenuDir" />
</ComponentGroup>
</Fragment>
</Wix>
Any ideas?

CleanUpUserData custom action run the $(var.MainExeID) application.
<CustomAction Id="CleanUpUserData" FileKey="$(var.MainExeID)" ExeCommand="cleanUpUserData" Execute="immediate" Impersonate="yes" Return="ignore"/>
The below condition (Installed AND NOT UPGRADINGPRODUCTCODE AND NOT REINSTALL) means the Custom action will be run if setup installed and not in upgrade or reinstall. So it will run in Repair or Uninstall(both will meet this condition). So your application is running in Uninstall.
<Custom Action="CleanUpUserData" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE AND NOT REINSTALL</Custom>
Check more about install and uninstall Conditions here.

After reviewing the answer given by #Vinoth I have changed the 'CleanUpUserData' custom action to this:
<Custom Action="CleanUpUserData" After="InstallInitialize">INSTALLED OR UPGRADINGPRODUCTCODE OR REINSTALL</Custom>
And this has now resolved the problem.

Related

WiX installing unselected features

I'm in the process of using WiX to create an install package with multiple features. It's using the Mondo UI to allow the user to select one or more features to install. The problem I'm having is that it's always installing all features, regardless of what the user selects.
Below is my WXS file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Setup Test 1" Language="1033" Version="1.0.0.0" Manufacturer="dbush" UpgradeCode="MYGUID="yes" InstallScope="perMachine" Comments="testing the installer" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="all" Title="all features" Description="everything" Level="1" Display="expand">
<Feature Id="file1" Title="file1" Description="file1.txt" Level="1">
<ComponentGroupRef Id="file1" />
</Feature>
<Feature Id="file2" Title="file2" Description="file2.txt" Level="10">
<ComponentGroupRef Id="file2" />
</Feature>
<Feature Id="regkey" Title="registry key" Description="registry properties to install" Level="11">
<ComponentGroupRef Id="regkey" />
</Feature>
</Feature>
<Property Id="PROP1" Value="replacement" />
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="setup_test_1" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="file1" Directory="INSTALLFOLDER">
<Component Id="file1.txt" Guid="MYGUID">
<File Id="file1.txt" Source="src/file1.txt" />
</Component>
</ComponentGroup>
<ComponentGroup Id="file2" Directory="INSTALLFOLDER">
<Component Id="file2.txt" Guid="MYGUID">
<File Id="file2.txt" Source="src/test2.txt" />
</Component>
</ComponentGroup>
<ComponentGroup Id="regkey" Directory="INSTALLFOLDER">
<Component Id="reg_key_1">
<RegistryValue Root='HKCU' Key='SOFTWARE\setup_test_1\properties'
Name='prop1' Value='[PROP1]'
Type='string' />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
What could be causing this?
I'm using WiX toolset 3.11.2 and Visual Studio 2017.
This was caused by the main Feature element having Id="all". Changing it to some other string such as "everything" allowed for individual features to be installed.
I wasn't able to find any documentation on why an Id with this name is a special case.

WIX Single Package Installer - Per machine Shortcuts

I followed this for getting a functioning Per-User/Per-machine installer working using ALLUSERS=2. Now, my issue is regarding getting shortcuts working properly with this setup. If I set MSIINSTALLPERUSER=1 (Single User) then my Desktop and StartMenu shortcuts are always added per user in the HKCU. If I set MSIINSTALLPERUSER={}, then I can get shortcuts per machine. In the custom UI, MSIINSTALLPERUSER is being set based on the selected radio button in the advanced portion of the UI. So, although the shortcuts are created last and their registry values are set to HKMU, the installer always chooses where to put the shortcuts based on the initial value of MSIINSTALLPERUSER.
Can anyone point me in the right direction to properly creating shortcuts based on the type of install selected in the advanced UI (Per User / Per Machine).
Here is my Product.wxs
`
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="HearCon" Language="1033" Version="2.0.299" Manufacturer="Tremetrics" UpgradeCode="73765816-7ba9-4a2b-89c3-ce1f26863b53">
<Package InstallerVersion="500" Compressed="yes" />
<MediaTemplate EmbedCab="yes" />
<Condition Message="Only Windows 7 and newer are supported">
<![CDATA[Installed OR VersionNT >= 601]]>
</Condition>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="ProductFeature" Title="Application" Level="1">
<ComponentGroupRef Id="HearConGroup" />
<ComponentRef Id="RA660Folder_Permission" />
</Feature>
<Feature Id="DesktopShortcutFeature" Title="Desktop Shortcut" Level="1">
<ComponentRef Id="DesktopShortcut" />
</Feature>
<Feature Id="StartMenuShortcutFeature" Title="Start Menu Shortcut">
<ComponentRef Id="ProgramMenuShortcut" />
<Condition Level="1">Privileged</Condition>
</Feature>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONFOLDER" Name="HearCon" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
<Directory Id="ProgramMenuFolder" />
<Directory Id="CommonAppDataFolder">
<Directory Id="RA660Folder" Name="RA660">
<Directory Id="RA660Driver" Name="Drivers" />
</Directory>
</Directory>
</Directory>
<Property Id="WixAppFolder" Value="WixPerUserFolder" />
<Property Id="ApplicationFolderName" Value="HearCon" />
<Property Id="ALLUSERS" Value="2" />
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
<Property Id="MSIINSTALLPERUSER" Value="1" />
<UIRef Id="WixUI_CustomAdvanced" />
<WixVariable Id="WixUIBannerBmp" Value="HearConBanner.bmp" />
</Product>
<Fragment>
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcut" Guid="10E3E42D-8B2E-471D-A6F9-6263C3491D4C">
<RegistryValue Root="HKMU" Key="Software\Tremetrics\HearCon" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<DirectoryRef Id="ProgramMenuFolder">
<Component Id="ProgramMenuShortcut" Guid="2C7EA878-B1B1-4B64-937A-6B583ED5E9B3">
<RegistryValue Root="HKMU" Key="Software\Tremetrics\HearCon" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<DirectoryRef Id="RA660Folder">
<Component Id="RA660Folder_Permission" Guid="0A538414-E53F-470E-9546-7EF193878F05">
<CreateFolder>
<util:PermissionEx User="Users" GenericAll="yes"/>
</CreateFolder>
</Component>
</DirectoryRef>
</Fragment>
</Wix>
`

how to set registry value in wix?

I am trying to set the registry value for my installation location in my WiX.
I want to set the key in localmachine/software
so I used the following WiX file. I am not getting any build error, everything is going right but the registry value is not set.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define engage.client.app_TargetDir=$(var.engage.client.app.TargetDir)?>
<Product Id="*" Name="EngageSetupCreator" Language="1033" Version="1.0.0.0" Manufacturer="KrimzenInc" UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" AdminImage="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="EngageSetupCreator" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ProductComponents2" />
<ComponentRef Id="InstallRegistryComponent"/>
<!--<ComponentGroupRef Id="Assets"/>-->
</Feature>
</Product>
<Fragment>
<SetDirectory Id="INSTALLFOLDER" Value="[WindowsVolume]Engage" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME">
<Directory Id="SUB_FOLDER" Name="Engage">
<Directory Id="INSTALLFOLDER" Name="EngageSetupCreator" >
<Component Id="InstallRegistryComponent" Guid="*">
<RegistryKey Id='ChessInfoBarInstallDir' Root='HKLM' Key='Software\Crimson\Engage' Action='createAndRemoveOnUninstall' >
<RegistryValue Type='string' Name='InstallDir' Value="[INSTALLFOLDER]" Action="write" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="engage.client.app.exe" Guid="*">
<File Id="engage.client.app.exe" Name="engage.client.app.exe" Source="$(var.engage.client.app_TargetDir)engage.client.app.exe" />
</Component>
<Component Id="CefSharp.BrowserSubprocess.exe" Guid="*">
<File Id="CefSharp.BrowserSubprocess.exe" Name="CefSharp.BrowserSubprocess.exe" Source="$(var.engage.client.app_TargetDir)CefSharp.BrowserSubprocess.exe" />
</Component>
</ComponentGroup>-->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch KrimzenEngage" />
<!-- Step 3: Include the custom action -->
<Property Id="WixShellExecTarget" Value="[#engage.client.app.exe]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
</Fragment>
</Wix>
but its not setting the value.
what iam doing wrong? I am running this in 64bit system.
On 64-bit systems, 32-bit software registry keys normally found in "HKLM\Software\ExampleSoftware" are instead found in "HKLM\Software\WOW6432Node\ExampleSoftware". Check here for more information.

How to install .net 4.5 from web installer using wix

first time using Wix so sorry if my question appears dumb. i have had a look around here for my answer and it appears I need to use a bundle.
I have my main wxs page with all my registry, files DB to install but how do I include a bundle within this file? I have this:
<?xml version="1.0" encoding="UTF-8"?>
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
xmlns:ui="http://schemas.microsoft.com/wix/UIExtension" >
<Bundle>
</Bundle>
<Product Id="*" Name="IMy Application Name" Language="1033" Version="2.0.0.0" Manufacturer="My Company Name" UpgradeCode="5d4e4839-11b8-403c-a440-796507b2f057">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />
<MajorUpgrade
AllowDowngrades="no"
AllowSameVersionUpgrades="no"
IgnoreRemoveFailure="no"
DowngradeErrorMessage="loc.NewerVersionInstalled"
Schedule="afterInstallInitialize"/>
ERRORS FROM HERE!
<Bundle Name="Prog" Version="1.0.0.0" Manufacturer="my Corporation" UpgradeCode="*">
<Chain>
<PackageGroupRef Id="Netfx45FullPackage" />
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="Netfx45FullPackage">
<ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q" SourceFile="..\SetupProject\dotnetfx45_full_x86_x64.exe" DetectCondition="(Netfx4FullVersion="4.5.50709") AND (NOT VersionNT64 OR (Netfx4x64FullVersion="4.5.50709"))" InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion="4.5.50709" OR Netfx4x64FullVersion="4.5.50709"))" />
TO HERE!
<MsiPackage Id="MyProg" Cache="no" Compressed="no" DisplayInternalUI="yes" Vital="yes" SourceFile="$(var.installerPath)\MyProgCore.msi" />
</PackageGroup>
</Fragment>**
<InstallUISequence>
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWPRODUCTFOUND</Custom>
</InstallUISequence>
<CustomAction Id='PreventDowngrading' Error='Newer version already installed' />
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONROOTDIRECTORY" />
<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" />
<Property Id="WixShellExecTarget" Value="[#InformedWorker]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<MediaTemplate EmbedCab="yes"/>
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message="This application requires .NET Framework 4.5. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK20]]>
</Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="Informed Worker"/>
<Directory Id="OriginalFilesFolder" Name="OriginalFiles" SourceName="SourceFiles"/>
<Directory Id="CopiedFilesFolder" Name="My Application Name" />
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Id="ConfigFOLDER" Name="My Application Name">
<Directory Id="EmptyDataFolderDir" Name="Data" />
<Directory Id="EmptyLogFolderDir" Name="Log" />
<Directory Id="RegComponents" Name="Reg" />
</Directory>
</Directory>
<!-- Step 1: Define the directory structure -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="My Application Name"/>
<Directory Id="DesktopFolder" Name="Desktop"></Directory>
</Directory>
</Directory>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="InformedWorker" Guid="*">
<File Id="InformedWorker" Source="SourceFiles\MyApp.exe" KeyPath="yes" Checksum="yes"/>
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="MyApp" />
</Feature>
<Feature Id="ProductFeature" Title="Setup" Level="1">
<ComponentGroupRef Id="DataFolderComponent" />
<ComponentGroupRef Id="LogFolderComponent" />
<ComponentGroupRef Id="RegComponents" />
<ComponentGroupRef Id="FilesFolder" />
<ComponentGroupRef Id="DBFolder" />
</Feature>
<Icon Id="InformedWorker" SourceFile="SourceFiles\MyApp.exe" />
<Property Id="ARPPRODUCTICON" Value="My Application Name" />
</Product>
<Fragment>
<ComponentGroup Id="DataFolderComponent" Directory="EmptyDataFolderDir">
<Component Id="CMP_MyEmptyDataDir" Guid="85DAD4AE-6404-4A40-B713-43538091B9D3" KeyPath="yes">
<CreateFolder />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="LogFolderComponent" Directory="EmptyLogFolderDir">
<Component Id="CMP_MyEmptyLogDir" Guid="a4594ec9-3101-4627-8ee7-d60d0a9b1f63" KeyPath="yes">
<CreateFolder />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="RegComponents" Directory="APPLICATIONROOTDIRECTORY">
<Component Id="RegistryEntries" Guid="9AB04D89-19B5-4729-9CD5-656C8C6B833F">
<RegistryKey Root="HKCR" Key="My Application Name">
<RegistryValue Type="string" Name="ClientRef" Value=""/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="FilesFolder" Directory="OriginalFilesFolder">
<Component Id="EXE_File" Guid="*">
<File Id="AppExe" Source="SourceFiles\MyApp.exe" KeyPath="yes">
<CopyFile Id="Copy_EXE" DestinationDirectory="APPLICATIONROOTDIRECTORY" DestinationName="MyApp.exe" />
</File>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="DBFolder" Directory="OriginalFilesFolder">
<Component Id="DB_File" Guid="a4eeb7a3-635c-41c3-b8c8-35c9c4f46d97">
<File Id="AppDB" Source="SourceFiles\Data.db3" KeyPath="yes">
<CopyFile Id="Copy_DB" DestinationDirectory="EmptyDataFolderDir" DestinationName="MyDB.db3" />
</File>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
But it does not like the inclusion of my bundle..?
Bundles are separate projects. One project for your MSI and one for your bundle.

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