A complete WiX 3.6 bundle example bootstrapping a .NET 4 Client Profile - wix

I tried to construct a working example of a WiX 3.6 installation script. We currently use WiX 3.5 and now we would like to begin installing the .NET 4 Client Profile framework as a pre-requisite for our MSI file that our product.wxs script creates. WiX 3.6 seems like the best way forward.
Is there a functional example of how to do this with WiX 3.6?
Here is our 3.5 script we use today:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!-- Version change handling -->
<?define UpgradeCode="###############################"?>
<?ifdef env.BUILD_NUMBER ?>
<?define ProductVersion="2.6.$(env.BUILD_NUMBER).0"?>
<?else ?>
<?define ProductVersion="2.6.0.0"?>
<?endif ?>
<Product Id="*" Name="###############################" Language="1033" Version="$(var.ProductVersion)" Manufacturer="###############################" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" />
<!-- Custom actions for this installer -->
<Binary Id="###############################.dll" SourceFile="..\..\Libraries\###############################.CA.dll" />
<!-- Kill ##### before installation begins -->
<CustomAction Id="Kill#####ActionId" BinaryKey="###############################.dll" DllEntry="Kill#####Action" Execute="immediate" Impersonate="yes" Return="check" />
<InstallExecuteSequence>
<Custom Action="Kill#####ActionId" Before="InstallInitialize" />
</InstallExecuteSequence>
<!-- ADD/REMOVE Programs icon -->
<Icon Id="##############.ico" SourceFile="D:\##############\Input_WIX\NonHeat\##############.exe" />
<Property Id="ARPPRODUCTICON" Value="##############.ico" />
<Property Id="ARPHELPLINK" Value="http://##############" />
<!-- EULA agreement -->
<WixVariable Id="WixUILicenseRtf" Value="D:\##############\Input_WIX\Heat\License.rtf" />
<!-- Installer images -->
<WixVariable Id="WixUIBannerBmp" Value="InstallerTopImage.rle" />
<WixVariable Id="WixUIDialogBmp" Value="InstallerSideImage.rle" />
<UIRef Id="WixUI_Minimal" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="1.0.0.0" Maximum="99.0.0.0" Property="PREVIOUSVERSIONSINSTALLED" IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<!-- Require ##### to be installed -->
<Property Id="#####4.INSTALLPATH">
<RegistrySearch Id="RegistryFoundInstallPath" Key="SOFTWARE\McNeel\#####ceros\4.0" Root="HKLM" Name="InstallPath" Type="directory" />
</Property>
<Property Id="#####4.RECENT">
<RegistrySearch Id="RegistryFoundMostRecent" Key="SOFTWARE\McNeel\#####ceros\4.0" Root="HKLM" Name="MostRecent" Type="raw" />
</Property>
<Property Id="VRAYCOMMONDIR">
<RegistrySearch Id="ReigstryVRayCommon" Key="Software\ASGvis" Root="HKLM" Name="Common_dir" Type="raw" />
</Property>
<Condition Message="##### 4 required before install">
#####4.RECENT
</Condition>
<!-- Require administrator priveleges -->
<Condition Message="You need to be an administrator to install this product.">
Privileged</Condition>
<!-- Require .NET 3.5 SP1 to install -->
<PropertyRef Id="NETFRAMEWORK35_SP_LEVEL" />
<Condition Message='This setup requires the .NET Framework 3.5 with Service Pack 1 be installed.'>
<![CDATA[Installed OR (NETFRAMEWORK35_SP_LEVEL AND NETFRAMEWORK35_SP_LEVEL = "#1")]]>
</Condition>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="#####4.INSTALLPATH">
<Directory Id="#####4.SYSTEM" Name="System"></Directory>
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="##############"></Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="##############" />
</Directory>
</Directory>
<!-- Set FULL permissions to our shared folders -->
<Directory Id="CommonAppDataFolder">
<Directory Id="CommonApp##############" Name="##############">
<Directory Id="MODELLIBPATH" Name="##############">
<Component Id="##############UserPermissions" Guid="##############">
<CreateFolder>
<util:PermissionEx GenericRead="yes" GenericWrite="yes" GenericExecute="yes" Delete="yes" DeleteChild="yes" User="Users" Domain="[MachineName]" />
</CreateFolder>
</Component>
</Directory>
<Directory Id="APPDATAPATH" Name="#####">
<Component Id="##############UserPermissions" Guid="FC4BF85F-E7A4-45DE-B25C-8F9419E75307">
<CreateFolder>
<util:PermissionEx GenericRead="yes" GenericWrite="yes" GenericExecute="yes" Delete="yes" DeleteChild="yes" User="Users" Domain="[MachineName]" />
</CreateFolder>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="FontsFolder"></Directory>
<Component Id="##############RegistryKeys" Guid="17A55BEA-605D-425a-AAEE-F35EC8C1061E" DiskId="1" KeyPath="yes">
<RegistryValue Id="##############RegInstallDir" Root="HKLM" Key="Software\##############\##############" Name="InstallPath" Action="write" Type="string" Value="[INSTALLLOCATION]" />
<RegistryValue Id="##############RegLibraryPath" Root="HKLM" Key="Software\##############\##############" Name="LibraryPath" Action="write" Type="string" Value="[INSTALLLOCATION]Library" />
<RegistryValue Id="##############RegModelLibraryPath" Root="HKLM" Key="Software\##############\##############" Name="ModelLibraryPath" Action="write" Type="string" Value="[MODELLIBPATH]" />
<RegistryKey Id="##############Reg#####PluginKey" Root="HKLM" Key="Software\McNeel\#####ceros\4.0\[#####4.RECENT]\Plug-ins\FCAF502A-1572-42a9-A2C3-F25D7953B1A5\PlugIn" Action="create" />
<RegistryValue Id="##############RegName#####4" Root="HKLM" Key="Software\McNeel\#####ceros\4.0\[#####4.RECENT]\Plug-ins\FCAF502A-1572-42a9-A2C3-F25D7953B1A5" Name="Name" Action="write" Type="string" Value="##############Server" />
<RegistryValue Id="##############Reg#####4" Root="HKLM" Key="Software\McNeel\#####ceros\4.0\[#####4.RECENT]\Plug-ins\FCAF502A-1572-42a9-A2C3-F25D7953B1A5" Name="FileName" Action="write" Type="string" Value="[INSTALLLOCATION]##############\##############Server.rhp" />
<RemoveRegistryKey Id="##############Skin" Root="HKLM" Key="Software\McNeel\#####ceros\4.0\Scheme: ##############" Action="removeOnInstall" />
</Component>
<Component Id="VRayKeys" Guid="{96E9EBAC-48B4-4517-9409-F921BE92B3AA}" DiskId="1" KeyPath="yes" NeverOverwrite="yes">
<RegistryValue Id="VRayKey" Root="HKLM" Key="Software\##############\Data" Name="Data" Action="write" Type="string" Value="FFFAAA" />
</Component>
<Component Id="VRayRegistryKeys" Guid="{4D8815FA-85E2-421f-8BF9-F7F5A4133E96}" DiskId="1" KeyPath="yes" NeverOverwrite="yes" Permanent="yes">
<Condition>
NOT VRAYCOMMONDIR
</Condition>
<RegistryValue Root="HKLM" Key="Software\ASGvis" Name="common_dir" Action="write" Type="string" Value="[INSTALLLOCATION]VRay\ASGVIS" />
</Component>
</Directory>
<Feature Id="##############Features" Title="#####" Level="1">
<ComponentGroupRef Id="##############" />
<ComponentRef Id="##############LibraryUserPermissions" />
<ComponentRef Id="##############SharedUserPermissions" />
<ComponentRef Id="##############RegistryKeys" />
<ComponentRef Id="VRayRegistryKeys" />
<ComponentRef Id="VRayKeys" />
<ComponentRef Id="ProgramMenuShortcuts" />
<ComponentRef Id="#####App" />
<ComponentRef Id="WixShortCut" />
<ComponentRef Id="##############ShortCut" />
<ComponentRef Id="TroubleShortCut" />
<ComponentRef Id="DesktopShortcut" />
<ComponentRef Id="VRayAuth" />
<ComponentRef Id="Fonts" />
</Feature>
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
</InstallExecuteSequence>
<UI />
</Product>
<Fragment>
<Icon Id="ShortCutIcon" SourceFile="D:\##############Stage\Input_WIX\NonHeat\##############.exe" />
<Icon Id="TroubleShooterIcon" SourceFile="D:\##############Stage\Input_WIX\Heat\TroubleShooter\TroubleShooter.exe" />
<Icon Id="TeamViewerIcon" SourceFile="D:\##############Stage\Input_WIX\Heat\support.exe" />
<DirectoryRef Id="ProgramFilesFolder">
<Component Id="ProgramMenuShortcuts" Guid="881BD571-4FAF-4aa4-AB6E-15BB1629BE06">
<CreateFolder Directory="ProgramMenuDir" />
<RemoveFolder Id="RemoveMenuShortcuts" Directory="ProgramMenuDir" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\##############\##############ShortCut" Name="InstalledStartMenuShortcuts" Type="integer" Value="1" />
</Component>
</DirectoryRef>
<!-- This file is not Heat'ed, so we need this to install the executable -->
<DirectoryRef Id="INSTALLLOCATION" FileSource="Files">
<Component Id="##############App" Guid="FA41A015-7D80-4e50-A909-94BBA4D7546A">
<File Id="#####_Executable" Vital="yes" Source="D:\##############Stage\Input_WIX\NonHeat\##############.exe" />
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLLOCATION" FileSource="Files">
<Component Id="WixShortCut" Guid="{8F2596B8-B7EC-4f40-AD64-DFC182A9353A}">
<RegistryKey Root="HKCU" Key="Software\##############\##############ShortCut" Action="create">
<RegistryValue Name="ShortCut" Value="1" Type="integer" KeyPath="yes" />
</RegistryKey>
<Shortcut Id="ProgramMenuApplicationShortcut" Name="##############" Target="[###############_Executable]" Directory="ProgramMenuDir" Show="normal" Icon="ShortCutIcon" />
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="TroubleShortCut" Guid="{9E960528-8798-41DD-8DEE-9C3336CD3C88}">
<RegistryKey Root="HKCU" Key="Software\#####\#####ShortCut" Action="create">
<RegistryValue Name="ShortCut2" Value="1" Type="integer" KeyPath="yes" />
</RegistryKey>
<Shortcut Id="TroubleshooterStartmenuShortcut" Name="Troubleshooter" Target="[INSTALLLOCATION]TroubleShooter\TroubleShooter.exe" Directory="ProgramMenuDir" Icon="TroubleShooterIcon" Show="normal"></Shortcut>
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="TeamViewerShortCut" Guid="{AD99CAC6-E485-444B-B075-2FD8BE4C87A8}">
<RegistryKey Root="HKCU" Key="Software\#####\#####ShortCut" Action="create">
<RegistryValue Name="ShortCut3" Value="1" Type="integer" KeyPath="yes" />
</RegistryKey>
<Shortcut Id="TeamviewerStartmenuShortcut" Name="Remote Assistance" Target="[INSTALLLOCATION]support.exe" Directory="ProgramMenuDir" Icon="TeamViewerIcon" />
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLLOCATION" FileSource="Files">
<Component Id="DesktopShortcut" Guid="{EA9632D1-08ED-4257-A78F-B2373A65A5CF}">
<RegistryKey Root="HKCU" Key="Software\#####\##############ShortCut" Action="createAndRemoveOnUninstall">
<RegistryValue Name="desktopShortcut" Value="1" Type="integer" KeyPath="yes" />
</RegistryKey>
<Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="#####" Icon="ShortCutIcon" Target="[######_Executable]" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FontsFolder">
<Component Id="Fonts" Guid="{8C8EE16C-92B6-4926-A41C-55B79429071C}" NeverOverwrite="yes">
<File Id="bradley" Source="Fonts\bradhitc.ttf" TrueType="yes" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<DirectoryRef Id="#####4.SYSTEM">
<Component Id="VRayAuth" Guid="{ABED80D1-6EBA-48db-83E0-7CF48B0A55E8}">
<File Id="VRayAuthFile" KeyPath="yes" Source="..\..\Libraries\VRayAuth.dll" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>

Heath Stewart's Introducing Managed Bootstrapper Applications provides a basic example in his blog.

You need to create a separate WiX bootstrapper project. See Building Installation Package Bundles in the WiX 3.6 documentation.

Once you have your bootstrapper, all you need to do is:
Add a reference to the file WixNetFxExtension.dll into your bootstrapper / managed bootstrapper application project.
Add the following as the first item in your chain.
<PackageGroupRef Id="NetFx40Web"/>
That's it. Further information and options are in the WixNetfxExtension documentation.

Related

32/64 bit WiX Combined Installer-Copying files only

I have an msi that copies files (PLC Code) to a directory(C:\Product\3.1\Boot), and modifies one key.
My visual studio project generates different PLC Code for the different architectures, but the destination is the same on both platforms. They key is in a different spot.
I have looked at using the arch-switch and conditional statements, but these look to only detect the architecture on which it is compiled, and not where the msi is run.
I know that you cant have 32/64 in the same MSI, but I'm not doing anything other than copying files and changing registries. I'm not putting anything in the windows directories/program files.
Though I would like it to appear with a version in the list of programs.
Is it possible in this case to have one installer?
Code
'''
<Product Id="*"
Name="Company"
Language="1033"
Version="4.09"
Manufacturer="CompanyInc."
UpgradeCode="YOUR_GUID"
>
<Package Id ="*"
InstallerVersion="200"
InstallPrivileges="elevated"
Compressed="yes"
InstallScope="perMachine"
Description="Company PLC Code"
Manufacturer="CompanyInc."
Keywords="PLC"
Comments="F"
/>
<!--Upgrade/install control-->
<MajorUpgrade
AllowDowngrades="yes"
/>
<!--GUI for install display-->
<UI>
<UIRef Id="WixUI_Minimal" /> <!--Define type of UI -->
</UI>
<Upgrade Id="GUID_HERE">
<UpgradeVersion OnlyDetect="no"
Property="SELFFOUND"
Minimum="1.0"
/>
</Upgrade>
<MediaTemplate EmbedCab="yes" />
<!-- Set the icon used in the programs and features list-->
<Icon Id='ProductIcon' SourceFile='Company.ico' />
<Property Id='ARPPRODUCTICON' Value='ProductIcon' />
<!-- Things to install-->
<Feature Id="Default" Title="PLC Code" Level="1">
<ComponentGroupRef Id="ProductComponentsx64" />
</Feature>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Company PLC" />
<Directory Id="BOOTDIR" />
<Directory Id="PLCDIR" />
</Directory>
</Directory>
<SetDirectory Id="BOOTDIR" Value="C:\CompanySoftware\3.1\Boot" />
<SetDirectory Id="PLCDIR" Value="C:\CompanySoftware\3.1\Boot\Plc" />
<!--Specify when actions occur actions during install-->
<InstallExecuteSequence>
<Custom Action="ARCHIVEBOOTDIR" After ="CostFinalize" />
<!--ToDo: copy files-->
</InstallExecuteSequence>
</Product>
<Fragment>
<!--64 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
<ComponentGroup Id="ProductComponentsx64">
<Component Id="BootComponents" Guid="" Directory="BOOTDIR">
<File Id="CurrentConfig.xml" Source="..\_Boot\CompanySoftware RT (x64)\CurrentConfig.xml" KeyPath="no" />
</Component>
<Component Id="PLCComponent" Guid="" Directory="PLCDIR">
<File Id="Port_851.app" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.app" KeyPath="no" />
<File Id="Port_851.autostart" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.autostart" KeyPath="no" />
<File Id="Port_851.cid" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.cid" KeyPath="no" />
<File Id="Port_851.crc" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.crc" KeyPath="no" />
<File Id="Port_851.occ" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.occ" KeyPath="no" />
<File Id="Port_851.ocm" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.ocm" KeyPath="no" />
<File Id="Port_851_boot.tizip" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851_boot.tizip" KeyPath="no" />
</Component>
<Component Id="StartupReg" Guid="" Directory="TARGETDIR">
<RegistryKey Root="HKLM"
Key="Software\WOW6432Node\Company\CompanySoftware3\System">
<RegistryValue Name="SysStartupState"
Type="integer"
Value ="5"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<!--32 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
<ComponentGroup Id="ProductComponentsx86">
<Component Id="BootComponents" Guid="" Directory="BOOTDIR">
<File Id="CurrentConfig.xml" Source="..\_Boot\CompanySoftware RT (x86)\CurrentConfig.xml" KeyPath="no" />
<File Id="Company.ico" Source="Company.ico" KeyPath="no" />
</Component>
<Component Id="PLCComponent" Guid="" Directory="PLCDIR">
<File Id="Port_851.app" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.app" KeyPath="no" />
<File Id="Port_851.autostart" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.autostart" KeyPath="no" />
<File Id="Port_851.cid" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.cid" KeyPath="no" />
<File Id="Port_851.crc" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.crc" KeyPath="no" />
<File Id="Port_851.occ" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.occ" KeyPath="no" />
<File Id="Port_851.ocm" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.ocm" KeyPath="no" />
<File Id="Port_851_boot.tizip" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851_boot.tizip" KeyPath="no" />
</Component>
<Component Id="StartupReg" Guid="" Directory="TARGETDIR">
<RegistryKey Root="HKLM"
Key="Software\Company\CompanySoftware3\System">
<RegistryValue Name="SysStartupState"
Type="integer"
Value ="5"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
'''
I was able to figure out how to get this to work. By using the Condition and ![CDATA[NOT(VersionNT64)]] to detect the version I was able to perform different actions!
<Product Id="*"
Name="Company PLC"
Language="1033"
Version="4.09"
Manufacturer="Company Inc."
UpgradeCode="Code"
>
<Package Id ="*"
InstallerVersion="200"
InstallPrivileges="elevated"
Compressed="yes"
InstallScope="perMachine"
Description="Company CompanySoftware PLC Code"
Manufacturer="Company Inc."
Keywords="PLC"
Comments="Company "
/>
<!--Upgrade/install control-->
<MajorUpgrade
AllowDowngrades="yes"
/>
<!--GUI for install display-->
<!-- future use for custom graphics on the MSI pages
<WixVariable Id="WixUIBannerBmp" Value="CompanyWixUIBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="CompanyWixUIBanner.bmp" />
-->
<UI>
<UIRef Id="WixUI_Minimal" />
<!--Define type of UI -->
</UI>
<Upgrade Id="CODE">
<UpgradeVersion OnlyDetect="no"
Property="SELFFOUND"
Minimum="1.0"
/>
</Upgrade>
<MediaTemplate EmbedCab="yes" />
<!-- Set the icon used in the Windows programs and features list-->
<Icon Id='ProductIcon' SourceFile='Company.ico' />
<Property Id='ARPPRODUCTICON' Value='ProductIcon' />
<!-- Things to install- This would normally appear as the selectable list of items to install in a regular installer-->
<Feature Id="Default_x64" Title="PLC Code x64" Level="1">
<Condition Level ="1">
<![CDATA[(VersionNT64)]]>
</Condition>
<ComponentGroupRef Id="ProductComponentsx64" />
</Feature>
<Feature Id="Default_x86" Title="PLC Code x86" Level="1">
<Condition Level ="1">
<![CDATA[NOT(VersionNT64)]]>
</Condition>
<ComponentGroupRef Id="ProductComponentsx86" />
</Feature>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Company PLC" />
<Directory Id="BOOTDIR" />
<Directory Id="PLCDIR" />
</Directory>
</Directory>
<SetDirectory Id="BOOTDIR" Value="C:\CompanySoftware\3.1\Boot" />
<SetDirectory Id="PLCDIR" Value="C:\CompanySoftware\3.1\Boot\Plc" />
</Product>
<Fragment>
<!--64 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
<ComponentGroup Id="ProductComponentsx64">
<Component Id="BootComponentsx64" Guid="" Directory="BOOTDIR">
<Condition>
<![CDATA[(VersionNT64)]]>
</Condition>
<File Id="CurrentConfig.xml.x64" Source="..\_Boot\CompanySoftware RT (x64)\CurrentConfig.xml" KeyPath="no" />
</Component>
<Component Id="PLCComponent.x64" Guid="" Directory="PLCDIR">
<Condition>
<![CDATA[(VersionNT64)]]>
</Condition>
<File Id="Port_851.app.x64" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.app" KeyPath="no" />
</Component>
<Component Id="StartupReg.x64" Guid="" Directory="TARGETDIR">
<Condition>
<![CDATA[(VersionNT64)]]>
</Condition>
<RegistryKey Root="HKLM"
Key="Software\WOW6432Node\Company\CompanySoftware\System">
<RegistryValue Name="SysStartupState"
Type="integer"
Value ="5"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<!--32 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
<ComponentGroup Id="ProductComponentsx86">
<Component Id="BootComponentsx86" Guid="" Directory="BOOTDIR">
<Condition>
<![CDATA[NOT(VersionNT64)]]>
</Condition>
<File Id="CurrentConfig.xml.x86" Source="..\_Boot\CompanySoftware RT (x86)\CurrentConfig.xml" KeyPath="no" />
</Component>
<Component Id="PLCComponentx86" Guid="" Directory="PLCDIR">
<Condition>
<![CDATA[NOT(VersionNT64)]]>
</Condition>
<File Id="Port_851.app.x86" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.app" KeyPath="no" />
</Component>
<Component Id="StartupReg.x86" Guid="" Directory="TARGETDIR">
<Condition>
<![CDATA[NOT(VersionNT64)]]>
</Condition>
<RegistryKey Root="HKLM"
Key="Software\Company\CompanySoftware\System">
<RegistryValue Name="SysStartupState"
Type="integer"
Value ="5"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>

Program crashes after update but works fine with clean install

I made a C# wpf program and at this point I have an update ready to release. I created an installer with the Wix Toolkit. So I can make the msi file. But when I do the upgrade from version 1.0.0.0 to 2.0.0.0 the program crashes after installation. If I first delete the c# program with version 1.0.0.0 and then install version 2.0.0.0 everything works fine. I don't know what I am doing wrong. this is my Product.wxs (my guid ids are in my program real ids):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ProductVersion="3.0.0.0"?>
<?define View_TargetDir=$(var.View.TargetDir)?>
<?define UpgradeCode="GUID-ID-FOR-UPGRADE"?>
<!--
Version 1.0
<Product Id="GUID-ID-1"
Name="MIDIMACRO"
Language="1033"
Version="1.0.0.0"
Manufacturer="vanlooverenkoen"
UpgradeCode="$(var.UpgradeCode)">
-->
<!--
Version 2.0
-->
<Product Id="GUID-ID-2"
Name="MIDIMACRO"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="vanlooverenkoen"
UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />
<Icon Id="icon.ico"
SourceFile="$(var.ProjectDir)Icon.ico" />
<Property Id="ARPPRODUCTICON"
Value="icon.ico" />
<WixVariable Id="WixUIBannerBmp"
Value="Images\installer_top-banner.bmp" />
<WixVariable Id="WixUIDialogBmp"
Value="Images\installer_background.bmp" />
<Property Id="WIXUI_INSTALLDIR"
Value="INSTALLFOLDER" />
<UI>
<UIRef Id="WixUI_InstallDir" />
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed
</Publish>
</UI>
<MajorUpgrade Schedule="afterInstallInitialize"
DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="MIDIMACRO" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ProgramFilesFolder_files" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
</Feature>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch MIDIMACRO" />
<!-- Step 3: Include the custom action -->
<Property Id="WixShellExecTarget" Value="[INSTALLFOLDER]MIDIMACRO.exe" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MIDIMACRO" />
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="MIDIMACRO" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="9bd13330-6540-406f-a3a8-d7f7c69ae7f9">
<Shortcut Id="ApplicationStartMenuShortcut" Name="MIDIMACRO" Description="MIDIMACRO" Target="[INSTALLFOLDER]MIDIMACRO.exe" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\MIDIMACRO" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="cde1e030-eb64-49a5-b7b8-400b379c2d1a">
<Shortcut Id="ApplicationDesktopShortcut" Name="MIDIMACRO" Description="MIDIMACRO" Target="[INSTALLFOLDER]MIDIMACRO.exe" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\MIDIMACRO" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
<Component Id="MahApps.Metro.dll" Guid="7903f312-19fb-45a5-8dc6-9823ada4cca0">
<File Id="MahApps.Metro.dll" Name="MahApps.Metro.dll" Source="$(var.View_TargetDir)MahApps.Metro.dll" />
</Component>
<Component Id="System.Windows.Interactivity.dll" Guid="4af9d18a-6205-4b23-887c-bf31685d548e">
<File Id="System.Windows.Interactivity.dll" Name="System.Windows.Interactivity.dll" Source="$(var.View_TargetDir)System.Windows.Interactivity.dll" />
</Component>
<Component Id="Newtonsoft.Json.dll" Guid="a97d5ecb-a716-43da-bd5f-83a7be929b47">
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="$(var.View_TargetDir)Newtonsoft.Json.dll" />
</Component>
<Component Id="Sanford.Multimedia.Midi.dll" Guid="e098aa86-d81e-48e9-84ba-4bc548e3f074">
<File Id="Sanford.Multimedia.Midi.dll" Name="Sanford.Multimedia.Midi.dll" Source="$(var.View_TargetDir)Sanford.Multimedia.Midi.dll" />
</Component>
<Component Id="Controller.dll" Guid="2d5d325c-234a-4ae4-b3fb-c87d346fccf5">
<File Id="Controller.dll" Name="Controller.dll" Source="$(var.View_TargetDir)Controller.dll" />
</Component>
<Component Id="View.exe.config" Guid="e1f88ab9-55fb-4bcc-a88c-2834c63469e6">
<File Id="View.exe.config" Name="MIDIMACRO.exe.config" Source="$(var.View_TargetDir)View.exe.config" />
</Component>
<Component Id="View.exe" Guid="7388a307-32fa-4f56-8fc6-a558de5ab7e6">
<File Id="View.exe" Name="MIDIMACRO.exe" Source="$(var.View_TargetDir)View.exe" />
</Component>
<Component Id="Model.dll" Guid="2684cc98-d124-41d4-85e6-99ecc2c7e131">
<File Id="Model.dll" Name="Model.dll" Source="$(var.View_TargetDir)Model.dll" />
</Component>
<Component Id="MaterialDesignThemes.Wpf.dll" Guid="ccbfeca9-31fe-4d5c-a31a-5a264f69fd58">
<File Id="MaterialDesignThemes.Wpf.dll" Name="MaterialDesignThemes.Wpf.dll" Source="$(var.View_TargetDir)MaterialDesignThemes.Wpf.dll" />
</Component>
<Component Id="MaterialDesignThemes.MahApps.dll" Guid="66e05999-a097-4595-bffe-99e4afef2369">
<File Id="MaterialDesignThemes.MahApps.dll" Name="MaterialDesignThemes.MahApps.dll" Source="$(var.View_TargetDir)MaterialDesignThemes.MahApps.dll" />
</Component>
<Component Id="MaterialDesignColors.dll" Guid="28ef4cb6-386f-4c82-8999-39ff3e1cde9a">
<File Id="MaterialDesignColors.dll" Name="MaterialDesignColors.dll" Source="$(var.View_TargetDir)MaterialDesignColors.dll" />
</Component>
<Component Id="WindowsInput.dll" Guid="0a28ba53-41df-42b0-b997-cc7e86a47180">
<File Id="WindowsInput.dll" Name="WindowsInput.dll" Source="$(var.View_TargetDir)WindowsInput.dll" />
</Component>
<Component Id="Hardcodet.Wpf.TaskbarNotification.dll" Guid="1f4aaa97-ed7c-4d12-ac25-d5b0ba0fb734">
<File Id="Hardcodet.Wpf.TaskbarNotification.dll" Name="Hardcodet.Wpf.TaskbarNotification.dll" Source="$(var.View_TargetDir)Hardcodet.Wpf.TaskbarNotification.dll" />
</Component>
<Component Id="CSCore.dll" Guid="6dcfcc86-12d8-42f6-a297-87560a5a3182">
<File Id="CSCore.dll" Name="CSCore.dll" Source="$(var.View_TargetDir)CSCore.dll" />
</Component>
<Component Id="MaterialDesignThemes.Wpf.pdb" Guid="9bf8b60e-6944-4e65-b2e6-35d826ffff3d">
<File Id="MaterialDesignThemes.Wpf.pdb" Name="MaterialDesignThemes.Wpf.pdb" Source="$(var.View_TargetDir)MaterialDesignThemes.Wpf.pdb" />
</Component>
<Component Id="System.Reactive.PlatformServices.dll" Guid="1e4cf4a5-ec59-41de-b42a-1de602185483">
<File Id="System.Reactive.PlatformServices.dll" Name="System.Reactive.PlatformServices.dll" Source="$(var.View_TargetDir)System.Reactive.PlatformServices.dll" />
</Component>
<Component Id="System.Reactive.Linq.dll" Guid="3253a150-0b73-4dde-902e-93ecb4f3039b">
<File Id="System.Reactive.Linq.dll" Name="System.Reactive.Linq.dll" Source="$(var.View_TargetDir)System.Reactive.Linq.dll" />
</Component>
<Component Id="System.Reactive.Interfaces.dll" Guid="02c68719-7df6-4814-ab49-c5c2660448c4">
<File Id="System.Reactive.Interfaces.dll" Name="System.Reactive.Interfaces.dll" Source="$(var.View_TargetDir)System.Reactive.Interfaces.dll" />
</Component>
<Component Id="System.Reactive.Core.dll" Guid="11757dde-fbdc-489b-8de5-2e12bbdce7c0">
<File Id="System.Reactive.Core.dll" Name="System.Reactive.Core.dll" Source="$(var.View_TargetDir)System.Reactive.Core.dll" />
</Component>
<Component Id="MaterialDesignColors.pdb" Guid="b689cffb-a71f-45a1-83cd-97e9e265d491">
<File Id="MaterialDesignColors.pdb" Name="MaterialDesignColors.pdb" Source="$(var.View_TargetDir)MaterialDesignColors.pdb" />
</Component>
<Component Id="View.pdb" Guid="d8b9af45-0c0d-4cb3-b5e2-8b2cfe3e66cf">
<File Id="View.pdb" Name="View.pdb" Source="$(var.View_TargetDir)View.pdb" />
</Component>
<Component Id="MaterialDesignThemes.MahApps.pdb" Guid="0623abd7-239e-41b3-aa8c-e0c76272eb0d">
<File Id="MaterialDesignThemes.MahApps.pdb" Name="MaterialDesignThemes.MahApps.pdb" Source="$(var.View_TargetDir)MaterialDesignThemes.MahApps.pdb" />
</Component>
<Component Id="Firebase.Database.dll" Guid="598ae72f-65e9-4b12-a88f-480e47c9f02c">
<File Id="Firebase.Database.dll" Name="Firebase.Database.dll" Source="$(var.View_TargetDir)Firebase.Database.dll" />
</Component>
<Component Id="Controller.pdb" Guid="08fa8a12-2c45-4bf8-8d68-6d036117331d">
<File Id="Controller.pdb" Name="Controller.pdb" Source="$(var.View_TargetDir)Controller.pdb" />
</Component>
<Component Id="Model.pdb" Guid="1d408632-0906-4ef1-82d8-197b7665a03a">
<File Id="Model.pdb" Name="Model.pdb" Source="$(var.View_TargetDir)Model.pdb" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="ProgramFilesFolder_files" Directory="ProgramFilesFolder">
<Component Id="resources_settings_icon.svg" Guid="7f417c29-b7f8-4282-b248-cb220436c6e0">
<File Id="resources_settings_icon.svg" Name="settings_icon.svg" Source="$(var.View_TargetDir)resources\settings_icon.svg" />
</Component>
<Component Id="resources_search_icon.svg" Guid="12291d78-6c79-4b35-9435-025a7bd4b063">
<File Id="resources_search_icon.svg" Name="search_icon.svg" Source="$(var.View_TargetDir)resources\search_icon.svg" />
</Component>
<Component Id="resources_flash_icon.svg" Guid="d84b95d6-bc6c-43d0-b7a3-15da8332cb2e">
<File Id="resources_flash_icon.svg" Name="flash_icon.svg" Source="$(var.View_TargetDir)resources\flash_icon.svg" />
</Component>
<Component Id="resources_gesture_icon.svg" Guid="3e5d81c5-7801-4fb3-9dda-4ba1fb593a87">
<File Id="resources_gesture_icon.svg" Name="gesture_icon.svg" Source="$(var.View_TargetDir)resources\gesture_icon.svg" />
</Component>
<Component Id="resources_add_circle_icon.svg" Guid="f56738c4-876a-4db3-8958-9d714450f1fa">
<File Id="resources_add_circle_icon.svg" Name="add_circle_icon.svg" Source="$(var.View_TargetDir)resources\add_circle_icon.svg" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
The most likely issue is the message in the log:
Disallowing installation of component: {CCBFECA9-31FE-4D5C-A31A-5A264F69FD58} since the same component with higher versioned keyfile exists
This implies that you did not update the file version of that Dll. The result is that the Dll is missing and your app crashes. There's a good explanation here:
https://blogs.msdn.microsoft.com/astebner/2015/11/16/why-windows-installer-removes-files-during-a-major-upgrade-if-they-go-backwards-in-version-numbers/
The basic issue is that early in the install it decides that it won't overwrite that file because the existing version on the system is greater than the "new" incoming file, so it decides not to install it at all. Those are the file version overwrite rules. However, later on the upgrade occurs that removes all the old files, but it still erroneously sticks with the idea that it shouldn't install that file, so it's missing at the end of the install.

Wix Toolset error when compiling

I am new with the Wix Toolset. I've been googling and reading tutorials. I have been tasked with taking over someone else's project and previous to this have not heard of Wix.
I am getting an error:
Unresolved reference to symbol 'WixComponentGroup:INSTALLDIR_files' in section 'Product:{C29D5782-ED4E-492C-B844-E15292A879F1}'.
Below is my FileFragment.wxs
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define SAACA_TargetDir=$(var.SAACA.TargetDir)?>
<?define StarkBlueADFSAdapter_TargetDir=$(var.StarkBlueADFSAdapter.TargetDir)?>
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Component Id="cmpABFF5E35E84AFD4197B11DE9DF2413DD" Guid="{FA545A1A-C5FA-483B-ADB0-97FFD9D64695}">
<File Id="fil8BE63D7D0CF5F7EC0CDA9144B4383379" KeyPath="yes" Source="$(var.SourcePath)\readme.txt" />
</Component>
<Directory Id="dirA5528701EE26FFBF346CCE20EE8ACE99" Name="bin">
<Component Id="cmpB0471075A3EB855663777A0FC25896C2" Guid="{665AA658-0A65-49DE-8307-EE91BC4F063D}">
<File Id="fil2BB254C1A2D8A4E77D8C72C2103E657E" KeyPath="yes" Source="$(var.SourcePath)\bin\HtmlAgilityPack.dll" />
</Component>
<Component Id="cmp20D48B7FD0F784EDD0D4AF7FFE4454B4" Guid="{0FE55C4C-EDD4-4254-AF87-4E31EE07F1E4}">
<File Id="fil2163FF814EA3BB0870CD1DD6AB64EEA0" KeyPath="yes" Source="$(var.SourcePath)\bin\Newtonsoft.Json.dll" />
</Component>
<Component Id="cmpB8A7273E7CF8289095FD4A3D8C0F9BCB" Guid="{7A68B365-6E07-47A2-A481-BD9B2567D259}">
<File Id="fil84309E5E3F29680E7406EC4FFA96726F" KeyPath="yes" Source="$(var.SourcePath)\bin\StarkBlue.Sdk.dll" />
</Component>
<Component Id="cmp00B7D4AA03C78496A43F55741AEC459A" Guid="{9FE30795-DB22-4A5E-BB6F-52BFC7A79F9D}">
<File Id="fil5EFEB6E94B7D336827DA980F6B37514B" KeyPath="yes" Source="$(var.SourcePath)\bin\StarkBlueADFSAdapter.dll" />
</Component>
</Directory>
<Directory Id="dir93F86CB27B2DA7095C70CFE88BB9B554" Name="gac">
<Component Id="cmpC268A2F89BED517F2C8732818BB63BB2" Guid="{366F268C-C167-4A31-885D-997444435CF4}">
<File Id="fil131A7F37C2A80BD4F1ACEB1018E753FC" KeyPath="yes" Source="$(var.SourcePath)\gac\HtmlAgilityPack.dll" Assembly=".net" />
</Component>
<Component Id="cmpA2E76D3D59511C82ED3654B3325B2E32" Guid="{57589654-0D56-4F87-8583-59C310917BCC}">
<File Id="fil0E9F401EBC5DC9D9D275E5F0D0F3DE0B" KeyPath="yes" Source="$(var.SourcePath)\gac\Newtonsoft.Json.dll" Assembly=".net" />
</Component>
<Component Id="cmp13E1C8F0D7F80DA38F4F15DA5C728E31" Guid="{864ABA0B-F047-48F5-BC78-927474D1B5F7}">
<File Id="filE284DC818AD996FCC7D7808969AB2ACE" KeyPath="yes" Source="$(var.SourcePath)\gac\StarkBlueADFSAdapter.dll" Assembly=".net" />
</Component>
</Directory>
<Directory Id="dir0D7D2D8D48347B01BECC2F06E2F3CA05" Name="Html">
<Component Id="cmp5ED9631EE2A298E6BD3DFCF7A8408CC6" Guid="{296EB9EF-EA98-4F30-AB0D-37EAD3455121}">
<File Id="fil5B40AB42B6271548DC495BCD83291822" KeyPath="yes" Source="$(var.SourcePath)\Html\adapter.html" />
</Component>
</Directory>
<Directory Id="dir2F6E2DBD7872AC6D99FFD4A591D8547D" Name="Images">
<Component Id="cmp612314B611D496B7304BF6AFC2B0164F" Guid="{D16A3092-B475-44C7-A2D4-97B474751831}">
<File Id="filD7AE89AB76FE8AE18D43BDFECCF54745" KeyPath="yes" Source="$(var.SourcePath)\Images\301.GIF" />
</Component>
</Directory>
<Directory Id="dirBC02319722C77D63C381B32042A43610" Name="Logs">
<Component Id="cmp2228494C17EEAE93171D610BE3F01B67" Guid="{75C0314D-C552-48EA-B5F1-1866752E47B9}" KeyPath="yes">
<CreateFolder />
</Component>
</Directory>
<Directory Id="dir56A9BD95D908D4AE3D37F91AAC2444E9" Name="Props">
<Component Id="cmp96195594B8A71C8A6C5F9496DD9D30E5" Guid="{196324C2-5AB6-4182-8A3B-232DDB4D9AEA}">
<File Id="filB7EEC2B5C1FF1908754C768C9440CE64" KeyPath="yes" Source="$(var.SourcePath)\Props\StarkBlueProperties.txt" />
</Component>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="StarkBlueAdapter">
<ComponentRef Id="cmpABFF5E35E84AFD4197B11DE9DF2413DD" />
<ComponentRef Id="cmpB0471075A3EB855663777A0FC25896C2" />
<ComponentRef Id="cmp20D48B7FD0F784EDD0D4AF7FFE4454B4" />
<ComponentRef Id="cmpB8A7273E7CF8289095FD4A3D8C0F9BCB" />
<ComponentRef Id="cmp00B7D4AA03C78496A43F55741AEC459A" />
<ComponentRef Id="cmpC268A2F89BED517F2C8732818BB63BB2" />
<ComponentRef Id="cmpA2E76D3D59511C82ED3654B3325B2E32" />
<ComponentRef Id="cmp13E1C8F0D7F80DA38F4F15DA5C728E31" />
<ComponentRef Id="cmp5ED9631EE2A298E6BD3DFCF7A8408CC6" />
<ComponentRef Id="cmp612314B611D496B7304BF6AFC2B0164F" />
<ComponentRef Id="cmp2228494C17EEAE93171D610BE3F01B67" />
<ComponentRef Id="cmp96195594B8A71C8A6C5F9496DD9D30E5" />
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="INSTALLDIR_files" Directory="INSTALLDIR">
<Component Id="Microsoft.Deployment.WindowsInstaller.dll" Guid="32cf1e97-fff1-4856-9399-13703f0c68dc">
<File Id="Microsoft.Deployment.WindowsInstaller.dll" Name="Microsoft.Deployment.WindowsInstaller.dll" Source="$(var.SAACA_TargetDir)Microsoft.Deployment.WindowsInstaller.dll" />
</Component>
<Component Id="Newtonsoft.Json.dll" Guid="d656bde0-aea0-42da-a6f5-d38cd57f7832">
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="$(var.SAACA_TargetDir)Newtonsoft.Json.dll" />
</Component>
<Component Id="SAACA.dll" Guid="67ad9f71-24ca-4f98-a1cc-f40f2ba3075f">
<File Id="SAACA.dll" Name="SAACA.dll" Source="$(var.SAACA_TargetDir)SAACA.dll" />
</Component>
<Component Id="Microsoft.IdentityServer.Web.dll" Guid="73611dd3-3dfb-4dd7-9d69-a581b02417b2">
<File Id="Microsoft.IdentityServer.Web.dll" Name="Microsoft.IdentityServer.Web.dll" Source="$(var.StarkBlueADFSAdapter_TargetDir)Microsoft.IdentityServer.Web.dll" />
</Component>
<Component Id="SAACA.pdb" Guid="c647afe6-ef7e-4522-aab1-dda437279fb9">
<File Id="SAACA.pdb" Name="SAACA.pdb" Source="$(var.SAACA_TargetDir)SAACA.pdb" />
</Component>
<Component Id="CustomAction.config" Guid="f7632128-e1b1-4dcb-ae10-1f646df90147">
<File Id="CustomAction.config" Name="CustomAction.config" Source="$(var.SAACA_TargetDir)CustomAction.config" />
</Component>
<Component Id="HtmlAgilityPack.dll" Guid="308bb776-597e-4069-8ede-6a9e1107eabc">
<File Id="HtmlAgilityPack.dll" Name="HtmlAgilityPack.dll" Source="$(var.StarkBlueADFSAdapter_TargetDir)HtmlAgilityPack.dll" />
</Component>
<Component Id="StarkBlue.Sdk.dll" Guid="9276faf8-9157-4948-9134-b7eac1bc590e">
<File Id="StarkBlue.Sdk.dll" Name="StarkBlue.Sdk.dll" Source="$(var.StarkBlueADFSAdapter_TargetDir)StarkBlue.Sdk.dll" />
</Component>
<Component Id="StarkBlueADFSAdapter.pdb" Guid="ac729a7f-fe62-465e-8d49-af938698b808">
<File Id="StarkBlueADFSAdapter.pdb" Name="StarkBlueADFSAdapter.pdb" Source="$(var.StarkBlueADFSAdapter_TargetDir)StarkBlueADFSAdapter.pdb" />
</Component>
<Component Id="StarkBlueADFSAdapter.dll" Guid="6c36f588-846b-43f8-a17b-b0d58f5dd764">
<File Id="StarkBlueADFSAdapter.dll" Name="StarkBlueADFSAdapter.dll" Source="$(var.StarkBlueADFSAdapter_TargetDir)StarkBlueADFSAdapter.dll" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="Resources_Images_files" Directory="Resources_Images">
<Component Id="Resources_Images_HelpDesk.png" Guid="761b57c7-3db9-4f51-a03d-6ec1130e3184">
<File Id="Resources_Images_HelpDesk.png" Name="HelpDesk.png" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Images\HelpDesk.png" />
</Component>
<Component Id="Resources_Images_OATH.png" Guid="28627250-524a-4f4b-a93b-66ea7aee9edf">
<File Id="Resources_Images_OATH.png" Name="OATH.png" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Images\OATH.png" />
</Component>
<Component Id="Resources_Images_Email.png" Guid="9dc0d4a9-fd8e-461a-acc6-ac8e533d3814">
<File Id="Resources_Images_Email.png" Name="Email.png" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Images\Email.png" />
</Component>
<Component Id="Resources_Images_301.GIF" Guid="a8127906-7582-43f7-bba1-fce87a877250">
<File Id="Resources_Images_301.GIF" Name="301.GIF" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Images\301.GIF" />
</Component>
<Component Id="Resources_Images_KBQ.png" Guid="db5e896a-754b-4d69-8b30-eb85e499c6ff">
<File Id="Resources_Images_KBQ.png" Name="KBQ.png" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Images\KBQ.png" />
</Component>
<Component Id="Resources_Images_Voice.png" Guid="7f724658-a985-4066-892e-b23e7f28f10c">
<File Id="Resources_Images_Voice.png" Name="Voice.png" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Images\Voice.png" />
</Component>
<Component Id="Resources_Images_SMS.png" Guid="ec00ce0b-6698-46f2-a1ea-362dac803b42">
<File Id="Resources_Images_SMS.png" Name="SMS.png" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Images\SMS.png" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="Resources_Html_files" Directory="Resources_Html">
<Component Id="Resources_Html_adapter.html" Guid="52cf0390-370e-45cf-aead-2da6573f1c12">
<File Id="Resources_Html_adapter.html" Name="adapter.html" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Html\adapter.html" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="Resources_files" Directory="Resources">
<Component Id="Resources_readme.txt" Guid="98690207-02bf-4b77-ba98-eb0641f1c69a">
<File Id="Resources_readme.txt" Name="readme.txt" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\readme.txt" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="Resources_Props_files" Directory="Resources_Props">
<Component Id="Resources_Props_StarkBlueProperties.txt" Guid="47aea511-d28d-4efd-bde4-0440ba6429c4">
<File Id="Resources_Props_StarkBlueProperties.txt" Name="StarkBlueProperties.txt" Source="$(var.StarkBlueADFSAdapter_TargetDir)Resources\Props\StarkBlueProperties.txt" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
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" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<?define UpgradeCode="b21f4fe8-3a40-4080-9bac-22e155496c10" ?>
<?define InfoURL="https://www.StarkBlue.com/" ?>
<Product Id="{C29D5782-ED4E-492C-B844-E15292A879F1}" Name="!(loc.ApplicationName)" Language="!(loc.Language)" Version="1.0.0.0" Manufacturer="!(loc.Manufacture)" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" AdminImage="yes" Manufacturer="!(loc.Manufacture)" Comments="!(loc.ProductComments)" Description="!(loc.ProductDescription)" Keywords="!(loc.ProductKeywords)" />
<?include Settings.wxi?>
<WixVariable Id="WixUILicenseRtf" Value="placeholder" />
<WixVariable Id="WixUIBannerBmp" Value="Resources\BannerTop.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="Resources\Dialog.bmp" />
<MajorUpgrade DowngradeErrorMessage="!(loc.NewerInstalled)" AllowSameVersionUpgrades="yes" />
<MediaTemplate EmbedCab="yes" />
<Property Id="REMADAPTERNAME" Secure="yes" />
<Property Id="REMINSTALLDIR" Secure="yes" />
<Property Id="REMISPRIMARY" Secure="yes" />
<Property Id="ARPHELPLINK" Value="$(var.InfoURL)" />
<Property Id="STOREDADAPTERNAME">
<RegistrySearch Id="ADAPTERNAME_REGSEARCH" Root="HKLM" Key="Software\StarkBlue\ADFSAdapter" Name="AdapterName" Type="raw" Win64="no" />
</Property>
<Property Id="STOREDINSTALLDIR">
<RegistrySearch Id="INSTALLDIR_REGSEARCH" Root="HKLM" Key="Software\StarkBlue\ADFSAdapter" Name="InstallDir" Type="raw" Win64="no" />
</Property>
<Property Id="STOREDISPRIMARY">
<RegistrySearch Id="ISPRIMARY_REGSEARCH" Root="HKLM" Key="Software\StarkBlue\ADFSAdapter" Name="IsPrimaryADFS" Type="raw" Win64="no" />
</Property>
<SetProperty Id="REMADAPTERNAME" Value="[STOREDADAPTERNAME]" After="AppSearch">NOT(REMADAPTERNAME)</SetProperty>
<SetProperty Id="REMINSTALLDIR" Value="[STOREDINSTALLDIR]" After="AppSearch">NOT(REMINSTALLDIR)</SetProperty>
<SetProperty Id="REMISPRIMARY" Value="[STOREDISPRIMARY]" After="AppSearch">NOT(REMISPRIMARY)</SetProperty>
<Binary Id="SAACA" SourceFile="$(var.SAACA.TargetDir)$(var.SAACA.TargetName).CA.dll" />
<CustomAction Id="PassProperties" Property="SetProperties" Value="installDir=[INSTALLDIR];enableLogs=[ENABLELOGS];managementUiFriendlyName=[MANAGEMENTUIFRIENDLYNAME];appID=[APPID];appKey=[APPKEY];StarkBlueRealmUrl=[StarkBlueREALMURL];useSamAccountName=[USESAMACCOUNTNAME];phoneimageurl=[PHONEIMAGEURL];smsimageurl=[SMSIMAGEURL];emailimageurl=[EMAILIMAGEURL];kbqimageurl=[KBQIMAGEURL];hdimageurl=[HDIMAGEURL];oathimageurl=[OATHIMAGEURL];progressgifurl=[PROGRESSGIFURL];disablessl=[DISABLESSL]" />
<CustomAction Id="SetProperties" BinaryKey="SAACA" DllEntry="SetProperties" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="PassAssemblyNameForReg" Property="RegisterWithADFS" Value="ASSEMBLYFULLNAME=[ASSEMBLYFULLNAME];ADAPTERNAME=[ADAPTERNAME];ISPRIMARY=[ISPRIMARY]" />
<CustomAction Id="RegisterWithADFS" BinaryKey="SAACA" DllEntry="RegisterWithADFS" Execute="deferred" Return="ignore" Impersonate="no" />
<CustomAction Id="PassAssemblyNameForUnreg" Property="UnregisterWithADFS" Value="ASSEMBLYFULLNAME=[ASSEMBLYFULLNAME];ADAPTERNAME=[STOREDADAPTERNAME];ISPRIMARY=[STOREDISPRIMARY]" />
<CustomAction Id="UnregisterWithADFS" BinaryKey="SAACA" DllEntry="UnregisterWithADFS" Execute="deferred" Return="ignore" Impersonate="no" />
<CustomAction Id="PassInstallDirToRemove" Property="RemoveExtraFilesFolders" Value="installDir=[REMINSTALLDIR]" />
<CustomAction Id="RemoveExtraFilesFolders" BinaryKey="SAACA" DllEntry="RemoveExtraFilesFolders" Execute="deferred" Return="ignore" Impersonate="no" />
<PropertyRef Id="NETFRAMEWORK45" />
<Condition Message="!(loc.DotNetFrameworkNeeded)">
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
<Condition Message="!(loc.OSVersion)">
<![CDATA[Installed OR (VersionNT >= 601)]]>
</Condition>
<InstallExecuteSequence>
<InstallExecute After="MsiPublishAssemblies" />
<Custom Action="PassProperties" Before="InstallFinalize">
NOT Installed
</Custom>
<Custom Action="SetProperties" After="PassProperties">
NOT Installed
</Custom>
<Custom Action="PassAssemblyNameForReg" Before="RegisterWithADFS">
NOT INSTALLED
</Custom>
<Custom Action="RegisterWithADFS" Before="InstallFinalize">
NOT Installed
</Custom>
<Custom Action="PassAssemblyNameForUnreg" Before="RemoveRegistryValues">
Installed
</Custom>
<Custom Action="UnregisterWithADFS" Before="InstallFinalize">
Installed
</Custom>
<Custom Action="PassInstallDirToRemove" Before="RemoveRegistryValues">
Installed
</Custom>
<Custom Action="RemoveExtraFilesFolders" Before="InstallFinalize">
Installed
</Custom>
</InstallExecuteSequence>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WindowsFolder" Name="WindowsFolder">
<Directory Id="ADFSFolder" Name="ADFS">
<Directory Id="INSTALLDIR" Name="StarkBlueAdapter">
<Component Id="SetRegSettings" Guid="7BAE916D-FE70-40B2-AD44-6D8A551643EA">
<RegistryKey Root="HKLM" Key="Software\StarkBlue\ADFSAdapter">
<RegistryValue Type="string" Name="InstallDir" Value="[INSTALLDIR]" KeyPath="yes" />
<RegistryValue Type="string" Name="AdapterName" Value="[ADAPTERNAME]" />
<RegistryValue Type="string" Name="IsPrimaryADFS" Value="[ISPRIMARY]" />
</RegistryKey>
</Component>
</Directory>
<Directory Id="Resources" Name="Resources">
<Directory Id="Resources_Html" Name="Html" />
<Directory Id="Resources_Images" Name="Images" />
<Directory Id="Resources_Props" Name="Props" />
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="StarkBlue TwoFacto Adapter" Level="1" ConfigurableDirectory="INSTALLDIR">
<ComponentGroupRef Id="StarkBlueAdapter" />
<ComponentRef Id="SetRegSettings" />
<ComponentGroupRef Id="INSTALLDIR_files" />
</Feature>
<UI>
<UIRef Id="WixUI_SAUI" />
</UI>
</Product>
</Wix>
I am struggling to give myself a crash course as well as try to resolve this.

Replacing unversioned files in WiX major upgrade

Okay, further examination and experimentation is showing that the problematic file, the pathwaysMdf file, IS being installed! However, after being installed, it's being REMOVED, by a RemoveFiles action!
I imagine it's doing this because that file is part of the original install, so it's doing it's job uninstalling and cleaning up. ARGH! What can I do?!
I am still having this problem. This is the closest I have come to a solution that works, and yet it doesn't quite work. Here is (most of) the code:
<Product Id='$(var.ProductCode)'
UpgradeCode='$(var.UpgradeCode)'
Name="Pathways"
Version='$(var.ProductVersion)'
Manufacturer='$(var.Manufacturer)'
Language='1033'>
<Package Id="*"
Description="Pathways Directory Software"
InstallerVersion="301"
Compressed="yes" />
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<Media Id="1" Cabinet="Pathways.cab" EmbedCab="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion
OnlyDetect="no"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Language="1033"
Property="OLDAPPFOUND"
/>
<UpgradeVersion
Minimum="$(var.ProductVersion)"
IncludeMinimum="yes"
OnlyDetect="yes"
Language="1033"
Property="NEWAPPFOUND"
/>
</Upgrade>
<!-- directories -->
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- program files directory -->
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="Pathways"/>
</Directory>
<!-- application data directory -->
<Directory Id="CommonAppDataFolder" Name="CommonAppData">
<Directory Id="CommonAppDataPathways" Name="Pathways" />
</Directory>
<!-- start menu program directory -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramsMenuPathwaysFolder" Name="Pathways" />
</Directory>
<!-- desktop directory -->
<Directory Id="DesktopFolder" />
</Directory>
<Icon Id="PathwaysIcon" SourceFile="\\Fileserver\Release\Pathways\Latest\Release\Pathways.exe" />
<!-- components in the reference to the install directory -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="Application" Guid="EEE4EB55-A515-4872-A4A5-06D6AB4A06A6">
<File Id="pathwaysExe" Name="Pathways.exe" DiskId="1" Source="\\Fileserver\Release\Pathways\Latest\Release\Pathways.exe" Vital="yes" KeyPath="yes" Assembly=".net" AssemblyApplication="pathwaysExe" AssemblyManifest="pathwaysExe" />
<File Id="pathwaysChm" Name="Pathways.chm" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Pathways.chm" />
<File Id="publicKeyXml" ShortName="RSAPUBLI.XML" Name="RSAPublicKey.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\RSAPublicKey.xml" Vital="yes" />
<File Id="staticListsXml" ShortName="STATICLI.XML" Name="StaticLists.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\StaticLists.xml" Vital="yes" />
<File Id="axInteropMapPointDll" ShortName="AXMPOINT.DLL" Name="AxInterop.MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\AxInterop.MapPoint.dll" Vital="yes" />
<File Id="interopMapPointDll" ShortName="INMPOINT.DLL" Name="Interop.MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Interop.MapPoint.dll" Vital="yes" />
<File Id="mapPointDll" ShortName="MAPPOINT.DLL" Name="MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Interop.MapPoint.dll" Vital="yes" />
<File Id="devExpressData63Dll" ShortName="DAAT63.DLL" Name="DevExpress.Data.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.Data.v6.3.dll" Vital="yes" />
<File Id="devExpressUtils63Dll" ShortName="UTILS63.DLL" Name="DevExpress.Utils.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.Utils.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraBars63Dll" ShortName="BARS63.DLL" Name="DevExpress.XtraBars.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraBars.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraNavBar63Dll" ShortName="NAVBAR63.DLL" Name="DevExpress.XtraNavBar.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraNavBar.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraCharts63Dll" ShortName="CHARTS63.DLL" Name="DevExpress.XtraCharts.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraCharts.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraEditors63Dll" ShortName="EDITOR63.DLL" Name="DevExpress.XtraEditors.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraEditors.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraPrinting63Dll" ShortName="PRINT63.DLL" Name="DevExpress.XtraPrinting.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraPrinting.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraReports63Dll" ShortName="REPORT63.DLL" Name="DevExpress.XtraReports.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraReports.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraRichTextEdit63Dll" ShortName="RICHTE63.DLL" Name="DevExpress.XtraRichTextEdit.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraRichTextEdit.v6.3.dll" Vital="yes" />
<RegistryValue Id="PathwaysInstallDir" Root="HKLM" Key="Software\Tribal Data Resources\Pathways" Name="InstallDir" Action="write" Type="string" Value="[INSTALLDIR]" />
</Component>
</DirectoryRef>
<!-- application data components -->
<DirectoryRef Id="CommonAppDataPathways">
<Component Id="CommonAppDataPathwaysFolderComponent" Guid="087C6F14-E87E-4B57-A7FA-C03FC8488E0D">
<CreateFolder>
<Permission User="Everyone" GenericAll="yes" />
</CreateFolder>
<RemoveFolder Id="CommonAppDataPathways" On="uninstall" />
<!-- <RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes" />-->
</Component>
<Component Id="Settings" Guid="A3513208-4F12-4496-B609-197812B4A953" NeverOverwrite="yes">
<File Id="settingsXml" KeyPath="yes" ShortName="SETTINGS.XML" Name="Settings.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Settings\settings.xml" Vital="yes" />
</Component>
<Component Id="Database" Guid="1D8756EF-FD6C-49BC-8400-299492E8C65D">
<!--<RegistryValue Root="HKLM" Key="Software\TDR\Pathways\Database" Name="installed" Type="integer" Value="1" KeyPath="yes" />-->
<File Id="pathwaysMdf" CompanionFile="pathwaysExe" Name="Pathways.mdf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.mdf" Vital="yes"/>
<File Id="pathwaysLdf" CompanionFile="pathwaysExe" Name="Pathways_log.ldf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.ldf" Vital="yes"/>
</Component>
</DirectoryRef>
<!-- shortcut components -->
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcutComponent" Guid="1BF412BA-9C6B-460D-80ED-8388AC66703F">
<Shortcut Id="DesktopShortcut"
Target="[INSTALLDIR]Pathways.exe"
Name="Pathways"
Description="Pathways Tribal Directory"
Icon="PathwaysIcon"
Show="normal"
WorkingDirectory="INSTALLDIR" />
<RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id ="ProgramsMenuPathwaysFolder">
<Component Id="ProgramsMenuShortcutComponent" Guid="83A18245-4C22-4CDC-94E0-B480F80A407D">
<Shortcut Id="ProgramsMenuShortcut" Target="[INSTALLDIR]Pathways.exe" Name="Pathways" Icon="PathwaysIcon" Show="normal" WorkingDirectory="INSTALLDIR" />
<RemoveFolder Id="ProgramsMenuPathwaysFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id="App" Title="Pathways Application" Level="1" Description="Pathways software" Display="expand" ConfigurableDirectory="INSTALLDIR" Absent="disallow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="Application" />
<ComponentRef Id="CommonAppDataPathwaysFolderComponent" />
<ComponentRef Id="Settings"/>
<ComponentRef Id="ProgramsMenuShortcutComponent" />
<Feature Id="Shortcuts" Title="Desktop Shortcut" Level="1" Absent="allow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="DesktopShortcutComponent" />
</Feature>
</Feature>
<Feature Id="Data" Title="Database" Level="1" Absent="allow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="Database" />
<!--<ComponentRef Id="MDF"/>
<ComponentRef Id="LDF"/>-->
</Feature>
<UIRef Id ="WixUI_FeatureTree"/>
<UIRef Id="WixUI_ErrorProgressText"/>
<UI>
<Error Id="2000">There is a later version of this program installed.</Error>
</UI>
<CustomAction Id="NewerVersionDetected" Error="2000" />
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallFinalize"/>
</InstallExecuteSequence>
</Product>
The problem I am having is that I need the two files in the Database component to replace the previous copies. Since these files are unversioned, I have attempted to use the CompanionFile tag set to the PathwaysExe since that is the main executable of the application, and it IS being updated, even if the log says it isn't! The strangest thing about this is that the PathwaysLdf file IS BEING UPDATED CORRECTLY, and the PathwaysMdf file IS NOT. The log seems to indicate that the "Existing file is of an equal version (Checked using version of companion)". This is very strange because that file is being replaced just fine.
The only idea I have left is that this problem has to do with the install sequence, and I'm not sure how to proceed! I have the InstallExecuteSequence set like I do because of the SettingsXml file, and my need to NOT overwrite that file, which is actually working now, so whatever solution works for the database files can't break the working settings file!
The full log is located at:
http://pastebin.com/HFiGKuKN
Try early scheduling of RemoveExistingProducts, instead of late scheduling and you should be OK.
<RemoveExistingProducts After="InstallInitialize" />

Remove existing product and install it again.guide me with example code

I want to add feature if setup run second time it will remove existing product first. without version feature. kindly guide me how i make sure if product already exist. setup will remove it first and install it again and after installation launch application.
OR
if product with same version already exist setup launch the Application.
its good if having sample code please share that too. Thanks advance.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define EmbeddApp_TargetDir=$(var.EmbeddApp.TargetDir)?>
<Product Id="*" Name="Troytec_TestEngine" Language="1033" Version="1.0.0.0" Manufacturer="TroyTec" UpgradeCode="c28ad43a-4fe4-4d14-ba4f-6422c00b13c2">
<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<!--<MajorUpgrade AllowDowngrades="yes" />-->
<MediaTemplate />
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="a61287ef-e184-421b-ac76-d8b91e489a6d">
<UpgradeVersion
Minimum="1.0.0.0" Maximum="99.0.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<Feature Id="ProductFeature" Title="Troytec_TestEngine" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
<ComponentRef Id="CMP_MyEmptyDir" />
<ComponentRef Id="CMP_MyEmptyDir2" />
<ComponentRef Id="CMP_MyEmptyDir3" />
</Feature>
<!--Step 2: Add UI to your installer / Step 4: Trigger the custom action-->
<!--<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" />
<!--Step 3: Include the custom action-->
<!--<Property Id="WixShellExecTarget" Value="[EmbeddApp.exe]" />-->
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
</Product>
<!--<Fragment>
<InstallExecuteSequence>
<Custom Action='902bc339-5cef-4f74-9d04-07941afa8ba1' Before='6d48fcc2-99cb-4ab6-867a-79f0484db05c'>
(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
</Custom>
</InstallExecuteSequence>
</Fragment>-->
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Troytec_TestEngine" >
<Directory Id="FOLDER1" Name="GPUCache">
</Directory>
<Directory Id="FOLDER2" Name="locales">
</Directory>
<Directory Id="FOLDER3" Name="swiftshader">
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Troytec_TestEngine" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop"/>
</Directory>
</Fragment>
<Fragment>
<Icon Id="City.ico" SourceFile="letter-t-24.ico" />
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="9bd13330-6540-406f-a3a8-d7f7c69ae7f9">
<Shortcut Id="ApplicationStartMenuShortcut" Name="Troytec_TestEngine" Description="MyWpfApplication" Target="[INSTALLFOLDER]EmbeddApp.exe" WorkingDirectory="INSTALLFOLDER" Icon ="City.ico" />
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\MyWpfApplication" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="cde1e030-eb64-49a5-b7b8-400b379c2d1a">
<Shortcut Id="ApplicationDesktopShortcut" Name="Troytec_TestEngine" Description="MyWpfApplication" Target="[INSTALLFOLDER]EmbeddApp.exe" WorkingDirectory="INSTALLFOLDER" Icon ="City.ico" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Troytec_TestEngine" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
<Component Id="EmbeddApp.exe" Guid="85c6f764-7517-4bc6-8e5a-ec52ae6ece1e">
<File Id="EmbeddApp.exe" Name="EmbeddApp.exe" Source="$(var.EmbeddApp_TargetDir)EmbeddApp.exe" />
</Component>
<Component Id="EmbeddApp.exe.config" Guid="8ee125d7-7043-498a-ad65-24055252218a">
<File Id="EmbeddApp.exe.config" Name="EmbeddApp.exe.config" Source="$(var.EmbeddApp_TargetDir)EmbeddApp.exe.config" />
</Component>
<Component Id="CefSharp.WinForms.dll" Guid="9fdb1c25-2275-4a14-8f4f-6832b7a617dc">
<File Id="CefSharp.WinForms.dll" Name="CefSharp.WinForms.dll" Source="$(var.EmbeddApp_TargetDir)CefSharp.WinForms.dll" />
</Component>
<Component Id="CefSharp.dll" Guid="9bdbc9cc-52a6-4213-b941-0248e995aa71">
<File Id="CefSharp.dll" Name="CefSharp.dll" Source="$(var.EmbeddApp_TargetDir)CefSharp.dll" />
</Component>
<Component Id="CefSharp.Core.dll" Guid="0e058c32-f73b-4b3f-acbd-b0c29c019297">
<File Id="CefSharp.Core.dll" Name="CefSharp.Core.dll" Source="$(var.EmbeddApp_TargetDir)CefSharp.Core.dll" />
</Component>
<!--other files-->
<Component Id="cef.pak" Guid="283c053a-c66e-4889-9c6b-2884b50b8cbb">
<File Id="cef.pak" Name="cef.pak" Source="$(var.EmbeddApp_TargetDir)cef.pak" />
</Component>
<Component Id="cef_100_percent.pak" Guid="12342b21-68e4-4874-ac3f-87ac8a9f40c2">
<File Id="cef_100_percent.pak" Name="cef_100_percent.pak" Source="$(var.EmbeddApp_TargetDir)cef_100_percent.pak" />
</Component>
<Component Id="cef_200_percent.pak" Guid="b261180b-0fa2-41ea-ba8d-63d329f2d047">
<File Id="cef_200_percent.pak" Name="cef_200_percent.pak" Source="$(var.EmbeddApp_TargetDir)cef_200_percent.pak" />
</Component>
<Component Id="cef_extensions.pak" Guid="a4a0a9d0-0308-46be-b24a-7de985018039">
<File Id="cef_extensions.pak" Name="cef_extensions.pak" Source="$(var.EmbeddApp_TargetDir)cef_extensions.pak" />
</Component>
<Component Id="CefSharp.BrowserSubprocess.Core.dll" Guid="f3e2f9bc-066a-43f0-9e14-445d7af00243">
<File Id="CefSharp.BrowserSubprocess.Core.dll" Name="CefSharp.BrowserSubprocess.Core.dll" Source="$(var.EmbeddApp_TargetDir)CefSharp.BrowserSubprocess.Core.dll" />
</Component>
<Component Id="CefSharp.BrowserSubprocess.Core.pdb" Guid="6127f13d-4b77-4a7f-992d-5b49abb2dfee">
<File Id="CefSharp.BrowserSubprocess.Core.pdb" Name="CefSharp.BrowserSubprocess.Core.pdb" Source="$(var.EmbeddApp_TargetDir)CefSharp.BrowserSubprocess.Core.pdb" />
</Component>
<Component Id="CefSharp.BrowserSubprocess.exe" Guid="4b029801-a97e-47a0-8f37-0a0540bed89e">
<File Id="CefSharp.BrowserSubprocess.exe" Name="CefSharp.BrowserSubprocess.exe" Source="$(var.EmbeddApp_TargetDir)CefSharp.BrowserSubprocess.exe" />
</Component>
<Component Id="CefSharp.BrowserSubprocess.pdb" Guid="d47f6d16-c6f5-4cf3-98a8-a342444e225f">
<File Id="CefSharp.BrowserSubprocess.pdb" Name="CefSharp.BrowserSubprocess.pdb" Source="$(var.EmbeddApp_TargetDir)CefSharp.BrowserSubprocess.pdb" />
</Component>
<Component Id="CefSharp.Core.pdb" Guid="f9ae3c06-3c49-40af-8047-da555d43304b">
<File Id="CefSharp.Core.pdb" Name="CefSharp.Core.pdb" Source="$(var.EmbeddApp_TargetDir)CefSharp.Core.pdb" />
</Component>
<Component Id="CefSharp.Core.xml" Guid="71e6a1c8-e1c2-4f41-bf09-c664cd62b0a7">
<File Id="CefSharp.Core.xml" Name="CefSharp.Core.xml" Source="$(var.EmbeddApp_TargetDir)CefSharp.Core.xml" />
</Component>
<Component Id="CefSharp.pdb" Guid="1f6df66a-972c-4945-a675-ab7f6bff3207">
<File Id="CefSharp.pdb" Name="CefSharp.pdb" Source="$(var.EmbeddApp_TargetDir)CefSharp.pdb" />
</Component>
<Component Id="CefSharp.WinForms.pdb" Guid="9f9aa753-8be7-4349-bf90-3799c9cb8560">
<File Id="CefSharp.WinForms.pdb" Name="CefSharp.WinForms.pdb" Source="$(var.EmbeddApp_TargetDir)CefSharp.WinForms.pdb" />
</Component>
<Component Id="CefSharp.WinForms.xml" Guid="56dc62fa-e64e-4f92-a8df-3415423e65cd">
<File Id="CefSharp.WinForms.xml" Name="CefSharp.WinForms.xml" Source="$(var.EmbeddApp_TargetDir)CefSharp.WinForms.xml" />
</Component>
<Component Id="CefSharp.xml" Guid="c567fe97-a411-477d-8f5b-82432593c090">
<File Id="CefSharp.xml" Name="CefSharp.xml" Source="$(var.EmbeddApp_TargetDir)CefSharp.xml" />
</Component>
<Component Id="chrome_elf.dll" Guid="8272cf27-65c6-499e-b503-b56ed9f80db1">
<File Id="chrome_elf.dll" Name="chrome_elf.dll" Source="$(var.EmbeddApp_TargetDir)chrome_elf.dll" />
</Component>
<Component Id="d3dcompiler_47.dll" Guid="3405163c-2405-41e7-aeef-3f4f65df1dd2">
<File Id="d3dcompiler_47.dll" Name="d3dcompiler_47.dll" Source="$(var.EmbeddApp_TargetDir)d3dcompiler_47.dll" />
</Component>
<Component Id="devtools_resources.pak" Guid="e2ffd1f6-9283-442f-b83f-fde86ddf1553">
<File Id="devtools_resources.pak" Name="devtools_resources.pak" Source="$(var.EmbeddApp_TargetDir)devtools_resources.pak" />
</Component>
<Component Id="EmbeddApp.pdb" Guid="e040e421-d4b4-4916-9089-f2efb1459594">
<File Id="EmbeddApp.pdb" Name="EmbeddApp.pdb" Source="$(var.EmbeddApp_TargetDir)EmbeddApp.pdb" />
</Component>
<Component Id="icudtl.dat" Guid="a14f1e18-8813-42c1-bad6-f40ad21d1b25">
<File Id="icudtl.dat" Name="icudtl.dat" Source="$(var.EmbeddApp_TargetDir)icudtl.dat" />
</Component>
<Component Id="libcef.dll" Guid="22493d08-ed8f-4bf3-9708-ace297e0d2d7">
<File Id="libcef.dll" Name="libcef.dll" Source="$(var.EmbeddApp_TargetDir)libcef.dll" />
</Component>
<Component Id="libEGL.dll" Guid="8ffc6d72-f929-4162-b7d4-49b8229aeb32">
<File Id="libEGL.dll" Name="libEGL.dll" Source="$(var.EmbeddApp_TargetDir)libEGL.dll" />
</Component>
<Component Id="libGLESv2.dll" Guid="8e759d91-3e4c-4a02-9ba7-6dfaf4c0fa7e">
<File Id="libGLESv2.dll" Name="libGLESv2.dll" Source="$(var.EmbeddApp_TargetDir)libGLESv2.dll" />
</Component>
<Component Id="natives_blob.bin" Guid="15c51480-6cf0-4127-a949-d899ba5a3422">
<File Id="natives_blob.bin" Name="natives_blob.bin" Source="$(var.EmbeddApp_TargetDir)natives_blob.bin" />
</Component>
<Component Id="snapshot_blob.bin" Guid="50f987cb-551e-4734-9d15-b59e0fa7f868">
<File Id="snapshot_blob.bin" Name="snapshot_blob.bin" Source="$(var.EmbeddApp_TargetDir)snapshot_blob.bin" />
</Component>
<Component Id="v8_context_snapshot.bin" Guid="492bb45e-1cdf-4ee1-992f-5479edff99e9">
<File Id="v8_context_snapshot.bin" Name="v8_context_snapshot.bin" Source="$(var.EmbeddApp_TargetDir)v8_context_snapshot.bin" />
</Component>
<!--<Component Id="data_0" Guid="b2f7d81e-587b-4e5e-835a-e29b394ae574">
<File Id="data_0" Name="data_0" Source="$(var.EmbeddApp_TargetDir)GPUCache\data_0" />
</Component>-->
</ComponentGroup>
<CustomAction Id="EXECUTE_AFTER_FINALIZE"
Execute="immediate"
Impersonate="no"
Return="asyncNoWait"
FileKey="EmbeddApp.exe"
ExeCommand="" />
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" Overridable="yes" />
<Custom Action="EXECUTE_AFTER_FINALIZE" After="InstallFinalize">NOT Installed</Custom>
<!--<RemoveExistingProducts Overridable="yes" Sequence="1" />
<Custom Action="EXECUTE_AFTER_FINALIZE" After="InstallFinalize">NOT Installed</Custom>-->
</InstallExecuteSequence>
</Fragment>
<!--<Fragment>
<ComponentGroup Id="ProductSubComponents" Directory="FOLDER1">
<Component Id="data_0" Guid="b2f7d81e-587b-4e5e-835a-e29b394ae574">
<File Id="data_0" Name="data_0" Source="$(var.EmbeddApp_TargetDir)GPUCache\data_0" />
</Component>
</ComponentGroup>
</Fragment>-->
</Wix>