How to make changing MSI install folder work in WiX? - wix

I created a MSI installer to install per-user.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Id="*"
Language="1033"
Manufacturer="my company"
Name="my software"
UpgradeCode="{9B85A1B0-6914-4573-92C1-27A6DB849E1D}"
Version="2.0.0.0">
<Package
Compressed="yes"
Description="a software"
InstallerVersion="500"
InstallScope="perUser"
Manufacturer="my company"
Comments="copyright" />
<MediaTemplate EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="AppDataFolder">
<Directory Id="ManufacturerFolder" Name="MyCompany">
<Directory Id="INSTALLFOLDER" Name="MySoftware">
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="ManufacturerFolder">
<Component Id="cmp_manufacturer" Guid="{264B9740-7BF6-4D90-9F0A-5B9489687C96}">
<RegistryValue
Root='HKCU'
Key='Software\MyCompany\MySoftware\Product'
Name='reg_manufacturer'
Value='manufacturer'
Type='string'
KeyPath='yes' />
<RemoveFolder Id="removeManufacturerFolder" On="uninstall" />
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="cmp_install" Guid="{0CF4AFFB-9676-4944-BCE7-9B0F54704677}">
<RegistryValue
Root='HKCU'
Key='Software\MyCompany\MySoftware\Product'
Name='reg_install'
Value='install'
Type='string'
KeyPath='yes' />
<File Id="file_install" Source="installfile.txt" />
<RemoveFolder Id="removeInstallFolder" On="uninstall" />
</Component>
</DirectoryRef>
<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Feature
Id="MainFeature"
Title="My Software"
Level="1">
<ComponentRef Id="cmp_manufacturer" />
<ComponentRef Id="cmp_install" />
</Feature>
</Product>
</Wix>
It works well if using default install folder C:\Users\xxx\AppData\Roaming\MyCompany\MySoftware. The file installfile.txt can be removed on uninstall. If I changed the install folder to a different folder using the WiXUI, the file installfile.txt can be copied to the right folder, But the copied file cannot be removed on uninstall. So why that file cannot be removed on uninstall, how to fix this?
I'll appreciate any help.

Related

unable to remove the desktop icon after uninstallation in WIX

I am using WIX installer for my application everything working fine but when I uninstall the application the desktop icon and startmenu icon is still there.
Whats wrong with my xml. followed the steps given by Wix documentation.
help..
XML:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="applicationName" Language="1033" Version="1.0.0.0" Manufacturer="manufacturerName" UpgradeCode="PUT-GUID-HERE">
<Package Id="*" InstallerVersion="201" Compressed="yes" InstallScope="perMachine" Comments="Windows Installer Package" ReadOnly="yes" InstallPrivileges="elevated" />
<Feature Id="ProductFeature" Title="applicationName" Level="1">
<ComponentRef Id="Permission.INSTALLFOLDER" />
<ComponentRef Id="ApplicationDeskShortcutComp" />
<ComponentGroupRef Id="HeatGenerated" />
</Feature>
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="CompanyNameFolder" Name="CompanyName">
<Directory Id="INSTALLFOLDER" Name="applicationName">
<Component Id="Permission.INSTALLFOLDER" Guid="*">
<CreateFolder>
<Permission User="Everyone" GenericAll="yes" />
</CreateFolder>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="applicationName" />
</Directory>
</DirectoryRef>-->
<!--Add the shortcut to installer package For DeskTop-->
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationDeskShortcutComp" Guid="*" Win64="yes" >
<Shortcut Id="ApplicationDeskShortcut" Name="applicationName" Description="applicationName" Target="[INSTALLFOLDER]exeName.exe" WorkingDirectory="DesktopFolder" Icon="IconName.exe" >
</Shortcut>
<RemoveFolder Id="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Manufacturer\ProductName" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<Property Id="MYWIXUI_MONDO" Value="INSTALLFOLDER" />
<UIRef Id="MyWixUI_Mondo" />
<Icon Id="IconName.exe" SourceFile=".\Icons\MainLogo.ico" />
<Property Id="ARPPRODUCTICON" Value="IconName.exe" />
</Wix>
No time to test this right now, but could you first please try to change this:
<Directory Id="DesktopFolder" Name="applicationName" />
into this:
<Directory Id="DesktopFolder" />
DesktopFolder is a built-in Windows Installer folder that should resolve to the user's desktop folder or the common desktop folder for all users depending on the setting for ALLUSERS (per-machine or per-user installation).
During installation, MSI directory resolution (costing) will assign the correct value to DesktopFolder for the system you are running on (based on ALLUSERS setting). I thought anything you assign to DesktopFolder yourself in your WiX source would be wiped out as soon as directory resolution has run, so there is no direct logical reason why the above WiX markup change suggestion should work, but I think it should be tested. Please test on a clean virtual, if available.

how to set registry value in wix?

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

WiX - installer ignoring my "perUser" install scope. Why?

I'm trying to build a very simple installer that just installs the package as a "per-user" application. No dialogs, just always install into the local app data folder. And it's ignoring me. And always installing to C:\Program Files.
I've set the InstallScope to "perUser", but left the installation directory as "ProgramFilesFolder". The documentation seems to suggest that that SHOULD get redirected, but that isn't happening.
Setup file below...
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="MyApplication"
Language="1033"
Version="1.0.0"
Manufacturer="MyCompany"
UpgradeCode="19E4E10A-558C-4D4A-BD2A-D6B8060FB917">
<Package
InstallerVersion="500"
Compressed="yes"
InstallPrivileges="limited"
InstallScope="perUser" />
<MajorUpgrade
DowngradeErrorMessage="A newer version of MyApplication is already installed." />
<MediaTemplate
EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyCompany MyApplication">
<Directory Id="JreFolder" Name="jre"/>
<Directory Id="LibFolder" Name="lib"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="MyCompany MyApplication"/>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id="CMP_MyApplication.exe">
<File Id="FILE_MyApplication.exe" Source="MyApplication.exe" KeyPath="yes"/>
</Component>
<Component Id="CMP_MyApplication.ini">
<File Id="FILE_MyApplication.l4j.ini" Source="MyApplication.l4j.ini" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="CMP_StartMenuShortcut" Guid="0B96A876-70FB-4E8E-8D27-B9B1E40C9B4D">
<Shortcut Id="ApplicationStartMenuShortcut" Name="MyCompany MyApplication" Description="MyCompany MyApplication"
Target="[#FILE_MyApplication.exe]" WorkingDirectory="INSTALLDIR"/>
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplication" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1" >
<ComponentGroupRef Id="JreGroup"/>
<ComponentGroupRef Id="LibGroup"/>
<ComponentRef Id="CMP_MyApplication.exe"/>
<ComponentRef Id="CMP_MyApplication.ini"/>
<ComponentRef Id="CMP_StartMenuShortcut"/>
</Feature>
</Product>
</Wix>
If you know that you want to install to the app data folder why use the 'ProgramFilesFolder'?
This will only confuse you (or any other person that will maintain your code) - try using the 'AppDataFolder' instead.

Why file get overwritten when KeyPath is set in Wix

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

How do I set ProgramFilesFolder subfolder permissions in Wix?

I am installing an application to the Program Files folder using WiX. I am using util:XmlFile to update the connectionStrings element but I am getting an error "Failed to open XML file C:\Program Files (x86)\developMENTALmadness\MainApp.exe.config system error -2147024786". I am trying to elevate permissions and set the permissions on the target file and parent folder, but the permissions aren't getting set.
Product.wxs:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="{7A04DDDD-F423-4E81-A42F-6831479ECF15}" Name="Installer"
Language="1033" Version="1.0.0.0"
Manufacturer="developMENTALmadness"
UpgradeCode="a65f51b5-8bf8-4490-8fab-899cc23a8e1b">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
InstallPrivileges="elevated" />
<MajorUpgrade DowngradeErrorMessage="A newer version is already installed." />
<MediaTemplate EmbedCab="yes" />
<Property Id="SQLSERVER" Value="(local)" />
<Property Id="SQLDATABASE" Value="OMDatabase" />
<Property Id="SQLINSTALLUSER" Value="sa" />
<Property Id="SQLINSTALLPWD" />
<Property Id="SQLUSER" />
<Property Id="SQLPWD" />
<Feature Id="ProductFeature" Title="Installer" Level="1">
<ComponentGroupRef Id="main_output"/>
</Feature>
<!--<UIRef Id="WixUI_Minimal"/>-->
<UIRef Id="CustomWizard"/>
<Binary Id="WixUI_Bmp_Banner"
SourceFile="$(var.MainApp.ProjectDir)info.png" />
<Binary Id="WixUI_Ico_Info"
SourceFile="$(var.MainApp.ProjectDir)favicon.ico"/>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="developMENTALmadness">
<Directory Id="target_root" Name="HelloWiX" >
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
I've generated the component list by using heat.exe and modified it (MainOutput.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">
<Fragment>
<DirectoryRef Id="target_root">
<Component Id="root_permissions" Guid="{87E634CC-8F0E-4610-961A-9B6C1BBDAEFE}">
<CreateFolder Directory="target_root">
<util:PermissionEx User="Users" GenericAll="yes" ChangePermission="yes" />
</CreateFolder>
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="main_output">
<Component Id="cmp2D913B775A49E24FBD0E4DB1A96F05A7" Directory="target_root" Guid="{6284BD47-6181-4220-8DF8-D76F43A608F4}">
<File Id="fil115E0DBDE48A315B4A1DABD091FE0184" KeyPath="yes" Source="$(var.MainApp.TargetPath)" />
</Component>
<Component Id="cmp1A2EDC339002636FAD729B028E1D726A" Directory="target_root" Guid="{45D6B30C-4C74-4260-B53F-855E5F4681FA}">
<File Id="filB9D96E3BAC71662F051EA888708285DA" KeyPath="yes" Source="$(var.MainApp.TargetPath).config" Vital="yes">
<util:PermissionEx User="Users" GenericAll="yes" ChangePermission="yes" />
</File>
<util:XmlFile Id="SetSqlConnection" Action="setValue"
ElementPath="/configuration/connectionStrings/add[\[]#name='database'[\]]"
File="[INSTALLFOLDER]$(var.MainApp.TargetFileName).config"
Value="Server=[SQLSERVER];Database=[SQLDATABASE];uid=[SQLUSER];pwd=[SQLPWD];"
Sequence="1"
SelectionLanguage="XPath" Name="connectionString" />
</Component>
</ComponentGroup>
</Fragment>
You can try the PermissionEx element.
Some similar questions:
WIX: Giving Permissions to a folder
Wix: How to set permissions for folder and all sub folders
Okay, so it would seem that it is better (recommended?) to store my config file in the CommonAppDataFolder (C:\ProgramData). This means I'll need to use the ConfigurationManager.OpenMappedExeConfiguration method to load my config now, like this:
ExeConfigurationFileMap map = new ExeConfigurationFileMap();
map.ExeConfigFilename = Path.Combine(#"C:\ProgramData\developMENTALmadness",
Path.GetFileName(Assembly.GetExecutingAssembly().Location) + ".config");
var config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
var name = config.AppSettings.Settings["FullName"].Value;
And a much more simplified version of what I'm trying to do is this:
<?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="{F15C9D98-5296-417C-847F-1DC1E67C3498}" Name="HelloWiXInstaller" Manufacturer="developMENTALmadness" Language="1033" Version="1.0.0.0" UpgradeCode="a3be08fb-680d-425a-a471-4ab16e4aa805">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="yes" />
<Property Id="FULL_NAME" Value="Mark J. Miller (installed)" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="developMENTALmadness">
<Component Id="CMP_HelloWiX.exe" Guid="{38FC6E96-37D6-4A2D-A584-F7D84705AC34}">
<File Id="EXE_HelloWiX.exe" Source="$(var.HelloWiX.TargetPath)" />
</Component>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Id="CONFIGFOLDER" Name="developMENTALmadness">
<Component Id="CMP_HelloWiX.exe.config" Guid="{6D470FDB-BF36-4648-BDBD-63D168F8D085}">
<File Id="CONFIG_HelloWiX.exe.config" Source="$(var.HelloWiX.TargetPath).config" />
<util:XmlFile Id="SetConfigValue" Action="setValue"
File="[CONFIGFOLDER]$(var.HelloWiX.TargetFileName).config"
ElementPath="/configuration/appSettings/add[\[]#key='FullName'[\]]"
Value="[FULL_NAME]"
SelectionLanguage="XPath"
Name="value"/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="HelloWiXProduct" Title="Hello, WiX" Level="1">
<ComponentRef Id="CMP_HelloWiX.exe" />
<ComponentRef Id="CMP_HelloWiX.exe.config" />
</Feature>
</Product>
And that works without any issues, so unless someone knows how to fix the other problem I'll go with this solution.
Here's a link to the full source for this sample on github: https://github.com/developmentalmadness/HelloWiX