Wix will not touch AppData Folder During Install - wix

So i've been working on this problem for days. My installer simply will not add anything into, or remove anything from, the roaming AppData folder in windows. I'm new to Wix and this is my first installer. The program is also shipped with a Bootstrapper which installs various prequisitaries and the .NET Framework. The code I have used is below.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="USBackup" Language="1033" Version="!(bind.fileVersion.USBackup.exe)" Manufacturer="Ed Rose" UpgradeCode="795ea019-054a-4f34-8c9a-cb4e607897c0">
<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Icon Id="icon.ico" SourceFile="..\USBackup\resources\usb.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<UIRef Id="WixUI_Minimal" />
<UIRef Id="WixUI_ErrorProgressText" />
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message='This setup requires the .NET Framework 4.5 installed.'>
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
<Feature Id="ProductFeature" Title="Setup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id='ProgramMenuDir' />
<ComponentRef Id='AppDataDir'/>
<ComponentRef Id='DevicesDir'/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="USBackup" />
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="USBackup">
<Component Id="ProgramMenuDir" Guid="{B01A59A5-ADA0-43FD-B14F-D479CD002E72}">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder" Name="CommonAppData">
<Directory Id="AppDataDir" Name="USBackup">
<Component Id="AppDataDir" Guid="{573BF504-1F52-40FE-A78A-96F43924379E}">
<RemoveFolder Id="AppDataDir" On="uninstall"/>
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
<Directory Id="DevicesDir" Name="Devices">
<Component Id="DevicesDir" Guid="{E145EA47-109F-42E7-ABAB-4E9A87FEC464}">
<RemoveFolder Id="DevicesDir" On="uninstall"/>
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Guid="{9D9BA12C-0859-46F0-B5E1-2A59BE96F83D}">
<File Source="$(var.USBackup.TargetPath)" KeyPath="yes">
<Shortcut Id="start" Directory="ProgramMenuDir" Name="USBackup" WorkingDirectory='INSTALLDIR' Icon="icon.ico" IconIndex="0" Advertise="yes" />
</File>
</Component>
<Component Guid="{6B473C52-6901-4FAC-A48B-20FC13A49C21}">
<File Source="..\USBackup\bin\Release\AutoUpdater.NET.dll" KeyPath="yes"/>
</Component>
<Component Guid="{6191F8CC-98A8-4424-A846-44DC1EB2A22C}">
<File Source="..\USBackup\bin\Release\USBackup.exe.config" KeyPath="yes"/>
</Component>
<Component Guid="{4E183A88-69DE-49D1-9142-13A2346443AF}">
<File Source="..\USBackup\bin\Release\USBackup.exe.manifest" KeyPath="yes"/>
</Component>
<!--Set to open on startup-->
<Component Id="RegistryKey" Guid="{8DBAB7DD-D9CD-4EC4-97F9-9A6131B40108}" Shared="yes">
<RegistryKey Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\Run">
<RegistryValue Id="startupValue" Action="write" Name="USBackup" Value="[INSTALLFOLDER]USBackup.exe" Type="string"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
It builds with no errors or warnings. Why won't it touch the AppData Directory?

You have not given any reason for it to create it.
Include <CreateFolder/>, as such
<Component Id="AppDataDir" Guid="{573BF504-1F52-40FE-A78A-96F43924379E}">
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
<CreateFolder />
</Component>

Related

WIX copying files harvested by heat, but does not create cab file

Fairly new to Wix. I have a working msi, but instead of a cab file next to the msi file, I am just getting a folder. I have spent several days trying to figure out why it is not putting the files in a cab file but I am completely at a loss.
The msi file performs exactly as I expect, but distributing the msi alongside a folder is less desirable than just the msi.
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="[Name]" Language="1033" Manufacturer="[Manufacturer]" Version="2.0.30"
UpgradeCode="af66ae21-61e4-4926-954d-ee89acf95ab3">
<Package InstallerVersion="200"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [Name] is already installed." />
<MediaTemplate/>
<Feature Id="ProductFeature" Title="[Title]" Level="1">
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
<ComponentGroupRef Id="WebApp" />
<ComponentGroupRef Id="ControlApp" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="ManufacturerName" Name="[Name]">
<Directory Id="INSTALLLOCATION" Name="[Name]" />
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="[Name]"/>
<Directory Id="DesktopFolder" Name="Desktop"></Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="844b584d-6d5f-4825-9541-c7caf74892fb">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="[Name]"
Description="[Name]"
Target="[INSTALLLOCATION]MyApp.exe"
WorkingDirectory="INSTALLLOCATION" />
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Name]" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="629d0ac6-8c63-4309-af33-975925584d1f">
<Shortcut Id="ApplicationDesktopShortcut"
Name="[Name]"
Description="[Name]"
Target="[INSTALLLOCATION]MyApp.exe"
WorkingDirectory="INSTALLLOCATION" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Name]" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
Set the Package/#Compressed attribute to yes.

unable to install database using Wix

i have tried lot of times but in sql server mgmt studio db is not created
sa user is already created i have changed the user name but that does not work
Please refer the following files:
Product.wxs :`
<?xml version="1.0" encoding="UTF-8"?>
<!--For [DBStep:1] Sql Database Add Reffrence 1] xmlns:util 2]xmlns:sql-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension">
<Product Id="680B2B06-567E-4BDB-9C37-63830049B51F"
Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="My System Pvt Ltd"
UpgradeCode="A25F60C4-4037-4DA8-BA2F-6C482EF7D05A">
<Package Id="*" InstallerVersion="100" Compressed="yes" InstallScope="perMachine"
InstallPrivileges="elevated" ReadOnly="yes"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!--Add Cab1.cab File inside the Package-->
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<!--For [DBStep:2] Create User and add *.sql File-->
<util:User Id="SQLUser" Name="[SQLUSER]" Password="[SQLPASSWORD]" />
<!--Create Database User-->
<Binary Id="CreateTable" SourceFile="CreateTable.sql" />
<!--Add your script File-->
<Property Id="SQLUSER">sa</Property>
<Property Id="SQLPASSWORD">amit#123</Property>
<Property Id="SQLSERVER">LOCAL</Property>
<!--Here We Install Our Main App-->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MY System Pvt Ltd"/>
</Directory>
<!-- Step 1: For the Program Menu -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="My System Pvt Ltd"/>
</Directory>
<!--Step 2:For Desktop Folder-->
<Directory Id="DesktopFolder"/>
<!--Step 3:For StartUp Folder-->
<Directory Id="StartupFolder"/>
</Directory>
<!--Step 4 :Add Main App exe-->
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="myapplication.exe" Guid="854D88DA-D213-4805-B3DC-51F43837B124">
<File Source="$(var.WixDemoWPFAppVS2012.UI.TargetPath)" Name="MYApp.exe"
Id="MyAppEXE" KeyPath="yes"/>
</Component>
<!--[DBStep:3]Componant for Database-->
<Component Id="SqlComponent" Guid="1B3F5D84-D1A0-409D-9ADC-71C562344FEE" KeyPath="yes">
<sql:SqlDatabase Id="SqlDatabase" Database="Foobar" User="SQLUser" Instance="SQLEXPRESS"
Server="[SQLSERVER]" CreateOnInstall="yes" DropOnUninstall="yes"
ContinueOnError="yes" >
<sql:SqlScript Id="CreateTable" BinaryKey="CreateTable" ExecuteOnInstall="yes" />
</sql:SqlDatabase>
</Component>
</DirectoryRef>
<!-- Step 1.1: Add the shortcut to your installer package Program Menu or Start Menu-->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="8C4AC870-043C-4D36-A868-35354F2A0D9A">
<!--Add Shortcut of the Application in start Menu-->
<Shortcut Id="ApplicationStartMenuShortcut" Name="MyApp" Description="My Application Description"
Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER">
<!--Add Icon to the ShortCut-->
<Icon Id="MYPMenuIcon" SourceFile=".\Desktop.ico" />
</Shortcut>
<Shortcut Id="UninstallShortcut"
Name="Uninstall My Software"
Description="Uninstalls My Software data"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]" />
<!--Remove the Folder At time of Uninstall-->
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Step 2.1: Add the shortcut to your installer package For DeskTop-->
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationDeskShortcutComp" Guid="29B9A804-9B2B-4E57-8803-E13C702FE100">
<Shortcut Id="ApplicationDeskShortcut" Name="MYAppDesk"
Description="My Application Description" Target="[INSTALLFOLDER]MyApp.exe"
WorkingDirectory="INSTALLFOLDER">
<Icon Id="MYDeskIcon" SourceFile=".\Desktop.ico" />
</Shortcut>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--Step 3.1: add Shortcut to StartUp Folder to run application when you login-->
<DirectoryRef Id="StartupFolder">
<Component Id="ApplicationStartUpShortcutComp" Guid="C4340A05-0D11-4F54-9DD7-7A058A35DE43">
<Shortcut Id="ApplicationStartUpDeskShortcut" Name="MYAppDesk" Description="My Application Description"
Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER">
<Icon Id="MyIconStartUp" SourceFile=".\Desktop.ico" />
</Shortcut>
<RemoveFolder Id="StartupFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--Add Component-->
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="myapplication.exe" />
<!--Step 1.2:Add Start menu or program Shortcut-->
<ComponentRef Id="ApplicationShortcut" />
<!--step 2.2Add DeskTop Shortcut-->
<ComponentRef Id="ApplicationDeskShortcutComp" />
<!--step 3.2Add DeskTop Shortcut-->
<ComponentRef Id="ApplicationStartUpShortcutComp"/>
<!--[DBStep:4]Add Database Componant to the WXS file-->
<ComponentRef Id="SqlComponent" />
</Feature>
</Product>
</Wix>
`
CreateTable.sql :`
CREATE TABLE Test (Value1 CHAR(50), Value2 INTEGER)
CREATE INDEX TestIndex ON Test (Value1)
`

Windows installer XML doesn't copy assemblies into the installer

I have trouble with my installer file. The installer does build without any error but when I try to install it on another computer (which obvious doesn't have have the required assemblies) I am getting an error which says that the assembly couldn't be found. Do I miss something obvious?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Recap" Language="1033" Version="1.0.0.0" Manufacturer="Lavahayn Technology" UpgradeCode="6824BC1E-B8AD-4EE0-B3F7-B3E84859B9F9">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<WixVariable Id="WixUILicenseRtf" Value="license.rtf" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="Recap" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ApplicationShortcuts"/>
<ComponentRef Id="UninstallerShortCut" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="Company" Name="Lavahayn Technology" >
<Directory Id="INSTALLFOLDER" Name="Recap" >
<Component Id="UninstallerShortCut" Guid="3AE87174-A4B1-4887-8D23-5CC651B0CED8">
<Shortcut Id="UninstallProduct2"
Name="Uninstall"
Description="Removes Recap from your computer"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"/>
<RemoveFolder Id="INSTALLFOLDER" On="uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuSubfolder" Name="Lavahayn Technology">
<Component Id="ApplicationShortcuts" Guid="432BC349-14B9-4224-B226-A0C55B25498A">
<Shortcut Id="RecapShortcut" Name="Recap" Description="Lavahayn Technology Recap"
Target="[INSTALLDIR]LavahaynTechnology.Launcher.exe" WorkingDirectory="INSTALLDIR"/>
<RegistryValue Root="HKCU" Key="Software\LavahaynTechnology\Recap"
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<Shortcut Id="UninstallProduct"
Name="Uninstall"
Description="Removes Recap from your computer"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="LavahaynTechnology.CsharpRecap.exe" Guid="1006A341-572D-45D7-9C0E-6F199C1CF0F5">
<File Id="LavahaynTechnology.CsharpRecap.exe" Source="$(var.CsharpRecap.TargetDir)CsharpRecap.exe" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="LavahaynTechnology.Database.dll" Guid="872452AA-7075-450B-A28F-90252E9DBB6F">
<File Id="LavahaynTechnology.Database.dll" Source="$(var.LavahaynTechnology.Database.TargetDir)LavahaynTechnology.Database.dll" KeyPath="yes" Assembly=".net"/>
</Component>
<Component Id="LavahaynTechnology.Launcher.exe" Guid="C0FEB7B4-87BF-4120-A40C-A5849B84F6DA">
<File Id="LavahaynTechnology.Launcher.exe" Source="$(var.LavahaynTechnology.Launcher.TargetDir)LavahaynTechnology.Launcher.exe" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="LavahaynTechnology.SDK.dll" Guid="55A6AEDA-162D-4BB7-9F7E-0BFBCB738402">
<File Id="LavahaynTechnology.SDK.dll" Source="$(var.LavahaynTechnology.SDK.TargetDir)LavahaynTechnology.SDK.dll" KeyPath="yes" Assembly=".net" />
</Component>
<Component Id="LavahaynTechnology.ObjectBase.dll" Guid="259F7357-D000-4B97-BA29-F11A176319CB">
<File Id="LavahaynTechnology.ObjectBase.dll" Source="$(var.LavahaynTechnology.ObjectBase.TargetDir)LavahaynTechnology.ObjectBase.dll" KeyPath="yes" Assembly=".net" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Error Message

WiX 3.8; Desktop shortcut depending on chosen feature

I'm struggling on creating a desktop-shortcut depending on the chosen feature(s) within the WiX-Installer. If I run the installer, no shortcut is appearing. Is doesn't matter if only one feature is chosen or both. Are there any ideas out there?
<?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="XXX" Name="MyProduct" Language="1031" Codepage="1252" Version="4.4.0" Manufacturer="MyCompany" UpgradeCode="XXX">
<Package Description="MyProductDescription" Comments="someText" InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Languages="1031"/>
<Media Id="1" Cabinet="application.cab" EmbedCab="yes" CompressionLevel="high"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Name="LfF" Id="INSTALLDIR">
<Directory Id="BIN" Name="bin"/>
<Component Id="App1.exe" Directory="BIN" Guid="XXX">
<File Id="App1.exe" KeyPath="yes" Source="$(var.src)\App1.exe" />
</Component>
<wix:Component Id="DesktopShortcutApp1" Directory="DesktopFolder" Guid="" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<wix:Shortcut Id="desktopShortcutApp1" Directory="DesktopFolder" Name="App1.exe" Target="[App1.exe]" WorkingDirectory="BIN" Icon="DesktopIconApp1.exe" IconIndex="0" />
<wix:RegistryValue Root="HKCU" Key="Software\[Manufacturer]\App1_Desktop_Shortcut" Name="installed" Type="integer" Value="1" />
</wix:Component>
<Component Id="App2.exe" Directory="BIN" Guid="XXX">
<File Id="App2.exe" KeyPath="yes" Source="$(var.src)\App2.exe" />
</Component>
<wix:Component Id="DesktopShortcutApp2" Directory="DesktopFolder" Guid="" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<wix:Shortcut Id="desktopShortcutApp2" Directory="DesktopFolder" Name="App2.exe" Target="[App2.exe]" WorkingDirectory="BIN" Icon="DesktopIconApp2.exe" IconIndex="0" />
<wix:RegistryValue Root="HKCU" Key="Software\[Manufacturer]\App2_Desktop_Shortcut" Name="installed" Type="integer" Value="1" />
</wix:Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder"/>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="MyProductName">
<Component Id="StartMenuShortcuts" Guid="XXX">
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value=""/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="App1" Level="1" Title="App1" TypicalDefault="advertise">
<ComponentRef Id="App1.exe" />
<ComponentRef Id="DesktopShortcutApp1" />
</Feature>
<Feature Id="App2" Level="1" Title="App2" TypicalDefault="advertise">
<ComponentRef Id="App2.exe" />
<ComponentRef Id="DesktopShortcutApp2"/>
</Feature>
<UI>
</UI>
<WixVariable Id="WixUIBannerBmp" Value="..\src\bannerapp.bmp"/>
<WixVariable Id="WixUIDialogBmp" Value="..\src\dialogapp.bmp"/>
<UIRef Id="WixUI_FeatureTree_NoLicense"/>
<Icon Id="DesktopIconApp1.exe" SourceFile="$(var.src)\App1.exe"/>
<Icon Id="DesktopIconApp2.exe" SourceFile=".$(var.src)\App2.exe"/>
</Product>
The script is a shortened version of the original one. Content of the Directory Id="BIN" is generated through heat.exe and modified with xslt.
After a lot of try and error I've found a solution.
make the shortcut element to a child of the component containig the file element
make the icon element to a child of the shortcut element
set the Level="32767" and TypicalDefault="install" in each feature (which means: Do not install that feature)
During the setup process choose the feature(s) you want to install and only for this/these the desktopshortcut will be created.
And here is the code:
<?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="XXX" Name="MyProduct" Language="1031" Codepage="1252" Version="4.4.0" Manufacturer="MyCompany" UpgradeCode="XXX">
<Package Description="MyProductDescription" Comments="someText" InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Languages="1031"/>
<Media Id="1" Cabinet="application.cab" EmbedCab="yes" CompressionLevel="high"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Name="LfF" Id="INSTALLDIR">
<Directory Id="BIN" Name="bin"/>
<Component Id="App1.exe" Directory="BIN" Guid="XXX">
<File Id="App1.exe" KeyPath="yes" Source="$(var.src)\App1.exe" />
<Shortcut Id="desktopShortcutApp1" Directory="DesktopFolder" Name="App1.exe" WorkingDirectory="BIN" Advertise="yes">
<Icon Id="DesktopApp1.ico" SourceFile="$(var.src)/App1.ico" />
</Shortcut>
</Component>
<Component Id="App2.exe" Directory="BIN" Guid="XXX">
<File Id="App2.exe" KeyPath="yes" Source="$(var.src)\App2.exe" />
<Shortcut Id="desktopShortcutApp2" Directory="DesktopFolder" Name="App2.exe" WorkingDirectory="BIN" Advertise="yes">
<Icon Id="DesktopApp2.ico" SourceFile="$(var.src)/App2.ico" />
</Shortcut>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder"/>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="MyProductName">
<Component Id="StartMenuShortcuts" Guid="XXX">
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value=""/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="App1" Level="32767" Title="App1" TypicalDefault="install">
<ComponentRef Id="App1.exe" />
</Feature>
<Feature Id="App2" Level="32767" Title="App2" TypicalDefault="install">
<ComponentRef Id="App2.exe" />
</Feature>
<UI>
</UI>
<WixVariable Id="WixUIBannerBmp" Value="$(var.src)/bannerapp.bmp"/>
<WixVariable Id="WixUIDialogBmp" Value="$(var.src)/dialogapp.bmp"/>
<UIRef Id="WixUI_FeatureTree_NoLicense"/>
</Product>
</Wix>

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