WiX installing unselected features - wix

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.

Related

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.

Wix InstanceTransform with AllowDowgrades

I have a wix setup project with wxs file,
I have configured MajorUpgrade AllowDowngrades="yes" and have defined instance transform to allow multiple instance.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define WixDemoWPFApp_TargetDir=$(var.WixDemoWPFApp.TargetDir)?>
<Product Id="*" Name="WixSetupWPFApp" Language="1033" Version="2.0.0.0" Manufacturer="Licence Owner"
UpgradeCode="ae4af8f5-9287-408a-b7bd-d2fdb89a8da7">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" />
<MediaTemplate />
<Property Id="INSTANCEID" Value="0" />
<InstanceTransforms Property="INSTANCEID">
<Instance Id="I01" ProductCode="{888F3620-F2AB-4C0B-A276-0A5AE9C0B6CB}" ProductName="WixDemo 3.7.4 Dev" />
<Instance Id="I02" ProductCode="{01D23E62-A369-43E1-914A-FA017B1EE822}" ProductName="WixDemo 3.7.4 Test" />
<Instance Id="I03" ProductCode="{00D804D7-0AD0-412C-805A-4D37FF74FFA3}" ProductName="WixDemo 3.7.5" />
<Instance Id="I04" ProductCode="{6C3E5B4E-BF7D-4E7E-A62A-B7DFB750F581}" ProductName="WixDemo 3.7.6" />
</InstanceTransforms>
<Feature Id="ProductFeature" Title="WixSetupWPFApp" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME">
<Directory Id="WixDemo" Name="WixDemo">
<Directory Id="INSTALLLOCATION" Name="WixDemo" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLLOCATION">
<Component Id="WixDemoWPFApp.exe" Guid="42907ee1-2bb2-4416-8d8f-cebc2bf53f09">
<File Id="WixDemoWPFApp.exe" Name="WixDemoWPFApp.exe" Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.exe" />
</Component>
<Component Id="WixDemoWPFApp.exe.config" Guid="ed8a9503-2eb1-4f49-b7f3-f027f542c93f">
<File Id="WixDemoWPFApp.exe.config" Name="WixDemoWPFApp.exe.config"
Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.exe.config" />
</Component>
<Component Id="WixDemoWPFApp.pdb" Guid="5bf6cd62-7bc7-42cd-839a-7b66d7e8a09a">
<File Id="WixDemoWPFApp.pdb" Name="WixDemoWPFApp.pdb" Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.pdb" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Now when i try to install multiple instance of the MSI, the previous instance gets Uninstalled even though the ProductName,ProductCode and InstanceId is different.
A major upgrade occurs because the UpgradeCode is the same in older and newer products, and in fact it requires the ProductCode to be different. If you need to have a specific upgrade for each different instance (and ProductCode) then add a new unique UpgradeCode to your Instance elements.

orphaned component error when building wix project

actually I just started learning wix today from the http://wixtoolset.org/documentation/
after reading and learning few things I got some confidence to start creating my first wix project and the configuration for the same is here:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="PersonalDailyInstaller" Language="1033" Version="1.0.0.0"
Manufacturer="Muhammad Sufiyan Shaikh" UpgradeCode="1327de13-b713-4cee-9778-be9c7460c0aa">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<!-- <MediaTemplate EmbedCab="yes" /> -->
<Feature Id="ProductFeature" Title="PersonalDailyInstaller" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="PersonalDaily" />
</Directory>
</Directory>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="MainExe" Guid="D7DC3991-2EE4-4BE5-B8B4-D15AC05592F3">
<File Id="MainExe" Source="bin\Debug\PersonalDaily.exe" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="DataPD" Guid="9DF21E80-F608-416A-BBAE-92AB3DA4CAE6">
<File Id="DataPD" Source="bin\Debug\data.PD" KeyPath="yes" Checksum="yes"/>
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="$(var.PersonalDaily.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
now when I build the wix project I am getting below error:
Severity Code Description Project File Line Suppression State
Error Found orphaned Component 'MainExe'. If this is a Product, every Component must have at least one parent Feature. To include a Component in a Module, you must include it directly as a Component element of the Module element or indirectly via ComponentRef, ComponentGroup, or ComponentGroupRef elements. PersonalDailyInstaller C:\Users\muham\documents\visual studio 2015\Projects\PersonalDaily\PersonalDailyInstaller\Product.wxs 25
any help or work around would be a great help for me. thanks in advance.
thanks everyone, actually I got it working by doing some changes and experiment on it, and updated working code is here:
and yes for sure, If anyone has better approach then this please post your answer...
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="PersonalDailyInstaller" Language="1033" Version="1.0.0.0"
Manufacturer="Muhammad Sufiyan Shaikh" UpgradeCode="1327de13-b713-4cee-9778-be9c7460c0aa">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<!-- <MediaTemplate EmbedCab="yes" /> -->
<Feature Id="ProductFeature" Title="PersonalDailyInstaller" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="Dlls" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="PersonalDaily" />
</Directory>
</Directory>
<ComponentGroup Id="Dlls" Directory="INSTALLFOLDER">
<Component Id="DataPD" Guid="9DF21E80-F608-416A-BBAE-92AB3DA4CAE6">
<File Id="DataPD" Source="..\PersonalDaily\bin\Debug\data.PD" KeyPath="yes" Checksum="yes"/>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="$(var.PersonalDaily.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

Wix doesn't include any of the files in the .MSI

i am trying to add files in my WIX installer, however it doesn't do that at the moment. i am staring at it for hours now and i just can't see what might be the problem. the referencing seems to work alright as well as the target location. the installer runs fine up to the point when it needs to install files of course.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Wix_setup" Language="1033" Version="1.0.0.0" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="Wix_setup" Level="1">
<!--create a seperate ComponentGroupRef and Fragment for each extra added program-->
<ComponentGroupRef Id="InstallationFiles" />
<ComponentGroupRef Id="DLLs" />
<ComponentGroupRef Id="IniFiles" />
<ComponentGroupRef Id="Scripts" />
<ComponentGroupRef Id="TeamViewer" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Wix_setup" />
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
<UIRef Id="WixUI_InstallDir"/>
</Fragment>
here is also a part of the references that i made using heat:
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Directory Id="dirE31AF1F0EC087256AE3A304B079577CE" Name="Program Files">
<Directory Id="dir686DC70E77279FD983277BA8C61F0AF5" Name="ActiveX Control Pad">
<Component Id="cmp50E37DF3A2B94BC9155ED7F4A264B47B" Guid="{F3CE58FB-5E41-4CD9-B761-C1B14A4F6C5F}">
<File Id="fil0D955E35C33B26A36350F0C4D02733AF" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\license.txt" />
</Component>
<Component Id="cmp367C764B6CFEC27E7632FB3F5B37A3F9" Guid="{FBEC3C91-3DCD-4CF3-B58D-B7C97AEB8ACF}">
<File Id="fil084E5B485699543BB060A10BAEEC4519" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\ped.cnt" />
</Component>
<Component Id="cmp5EF25EC501B2689546C69D7C8B18B79F" Guid="{182C17ED-01E1-4529-A733-D3FBA7FF61EE}">
<File Id="filF5043624868A85726914B5A383640B6F" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\PEd.exe" />
</Component>
<Fragment>
<ComponentGroup Id="Wix_database" Directory="INSTALLFOLDER" >
<ComponentRef Id="cmp50E37DF3A2B94BC9155ED7F4A264B47B" />
<ComponentRef Id="cmp367C764B6CFEC27E7632FB3F5B37A3F9" />
<ComponentRef Id="cmp5EF25EC501B2689546C69D7C8B18B79F" />
the ComponentGroupRef's and the Fragments they are connected to are currently not yet in use and dont have an impact on the program (the Fragments are left out of this example)
can anybody see what i might have done wrong or what is missing?
thanks in advance,
i have solved the errors. it had a conflict with my reference file i still had in the project, because of that it did see it as two references to the same symbol that i declared the way heavyd suggested.
thanks for the support Heavyd.

Wix launches application when uninstalling

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.