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
Related
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.
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.
I have a wix setup project with wxs file,
I have configured MajorUpgrade AllowDowngrades="yes" and have defined instance transform to allow multiple instance.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define WixDemoWPFApp_TargetDir=$(var.WixDemoWPFApp.TargetDir)?>
<Product Id="*" Name="WixSetupWPFApp" Language="1033" Version="2.0.0.0" Manufacturer="Licence Owner"
UpgradeCode="ae4af8f5-9287-408a-b7bd-d2fdb89a8da7">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" />
<MediaTemplate />
<Property Id="INSTANCEID" Value="0" />
<InstanceTransforms Property="INSTANCEID">
<Instance Id="I01" ProductCode="{888F3620-F2AB-4C0B-A276-0A5AE9C0B6CB}" ProductName="WixDemo 3.7.4 Dev" />
<Instance Id="I02" ProductCode="{01D23E62-A369-43E1-914A-FA017B1EE822}" ProductName="WixDemo 3.7.4 Test" />
<Instance Id="I03" ProductCode="{00D804D7-0AD0-412C-805A-4D37FF74FFA3}" ProductName="WixDemo 3.7.5" />
<Instance Id="I04" ProductCode="{6C3E5B4E-BF7D-4E7E-A62A-B7DFB750F581}" ProductName="WixDemo 3.7.6" />
</InstanceTransforms>
<Feature Id="ProductFeature" Title="WixSetupWPFApp" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME">
<Directory Id="WixDemo" Name="WixDemo">
<Directory Id="INSTALLLOCATION" Name="WixDemo" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLLOCATION">
<Component Id="WixDemoWPFApp.exe" Guid="42907ee1-2bb2-4416-8d8f-cebc2bf53f09">
<File Id="WixDemoWPFApp.exe" Name="WixDemoWPFApp.exe" Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.exe" />
</Component>
<Component Id="WixDemoWPFApp.exe.config" Guid="ed8a9503-2eb1-4f49-b7f3-f027f542c93f">
<File Id="WixDemoWPFApp.exe.config" Name="WixDemoWPFApp.exe.config"
Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.exe.config" />
</Component>
<Component Id="WixDemoWPFApp.pdb" Guid="5bf6cd62-7bc7-42cd-839a-7b66d7e8a09a">
<File Id="WixDemoWPFApp.pdb" Name="WixDemoWPFApp.pdb" Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.pdb" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Now when i try to install multiple instance of the MSI, the previous instance gets Uninstalled even though the ProductName,ProductCode and InstanceId is different.
A major upgrade occurs because the UpgradeCode is the same in older and newer products, and in fact it requires the ProductCode to be different. If you need to have a specific upgrade for each different instance (and ProductCode) then add a new unique UpgradeCode to your Instance elements.
Enviorment:Win7+VS2012+Wix3.7.
Complile error:
Unresolved reference to symbol 'WixUI:WixUI_InstallDir' in section
'Product:{9E327731-0EAC-4A02-9C3C-9C136ACCE05B}'
Code is the follow:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="{9E327731-0EAC-4A02-9C3C-9C136ACCE05B}" Name="SetupProject2" Language="1033" Version="1.1.1.1" Manufacturer="Anser" UpgradeCode="61eb40a6-21d9-4f23-9c9e-078b98707371">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupProject2" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Property Id="WIXUI_INSTALLDIR">INSTALLDIR</Property>
<UIRef Id="WixUI_InstallDir"/>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject2" />
</Directory>
</Directory>
</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="ProductComponent" DiskId="1" Guid="{65F464D6-BC0B-4679-9546-CF8B6CFCE184}">
<File Name='test.exe' Source="test.exe" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I can't find the reason.Who can help me?
Reference WixUIExtension.dll in the project.
I refer to the similar question in the follow site.
How to add a UI to a WiX 3 installer?
I'm aware of similar questions inside stackoverflow:
WIX:default directory in WixUI_InstallDir,
WIX installer root directory and versioning,
Is it possible to have two root directories in WIX,
copy file to custom dir in another partition,
How to create a directory in wix?
however none of them shows a simple and immediate code to create a folder inside the C:\ folder (not hard coded but should be the root disk or system disk or whatever you would call the disk which contains the Windows folder) and to copy files inside it.
In other words how can Wix create a C:\MynewDir\example.jar folder?
Here's what I tried:
<?xml version="1.0" encoding="UTF-8"?>
<!-- WiX installer MyProgram by Mark Seuffert -->
<?define ProductVersion = "13.1.2.3"?>
<?define ProductUpgradeCode = "12345678-1234-1234-1234-111111111112"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" Name="MyProgram" Version="$(var.ProductVersion)" Manufacturer="COMPANY" Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyProgram">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
<File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" />
</Component>
</Directory>
</Directory>
<Directory Id="ANOTHERLOCATION" FileSource="C:\MynewDir">
</Directory>
</Directory>
<DirectoryRef Id="ANOTHERLOCATION" FileSource="C:\MynewDir">
<Component Id="ApplicationFiles2" Guid="12345678-1234-1234-1235-111111111111">
<File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" />
<CreateFolder />
</Component>
</DirectoryRef>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate" />
</InstallExecuteSequence>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles2" />
<ComponentRef Id="ApplicationFiles" />
</Feature>
</Product>
</Wix>
EDIT 1:
Yan Sklyarenko just found what I was looking for, that's the WindowsVolume (I don't know how I missed it inside http://msdn.microsoft.com/en-us/library/windows/desktop/aa370905%28v=vs.85%29.aspx#system_folder_properties microsoft document).
However how do I replace FileSource="C:\MynewDir" with FileSource="[WindowsVolume]MynewDir" ??? because apparently even with WINDOWSVOLUME the resulting volume chosen is always D:\ in my computer which has more available space :(
EDIT 2 I updated my code using Yan Sklyarenko's second sample ( ####newpart#### identifies parts where code differs), however behaviour is still the same, the installer chooses the disk with more free space (D:\ in my case) and not C:\ where windows is..
<?xml version="1.0" encoding="UTF-8"?>
<!-- WiX installer MyProgram by Mark Seuffert -->
<?define ProductVersion = "13.1.2.3"?>
<?define ProductUpgradeCode = "12345678-1234-1234-1234-111111111112"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" Name="MyProgram" Version="$(var.ProductVersion)" Manufacturer="COMPANY" Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyProgram">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
<File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" />
</Component>
</Directory>
</Directory>
<Directory Id="ANOTHERLOCATION" FileSource="C:\MynewDir">
####newpart####<Component Id="ApplicationFiles2" Guid="12345678-1234-1234-1235-111111111111">
<File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" />
<CreateFolder />
</Component>
</Directory>
</Directory>
####newpart####<SetDirectory Id="ANOTHERLOCATION" Value="[WINDOWSVOLUME]" />
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate" />
</InstallExecuteSequence>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles2" />
<ComponentRef Id="ApplicationFiles" />
</Feature>
</Product>
</Wix>
EDIT 3 The last code snippet above should work however change the casing of WINDOWSVOLUME to WindowsVolume as suggested.
Here is a complete working solution based on your code simplified (notice the comment in the code):
<?define ProductVersion = "13.1.2.3"?>
<?define ProductUpgradeCode = "12345678-1234-1234-1234-111111111112"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" Name="MyProgram"
Version="$(var.ProductVersion)" Manufacturer="COMPANY" Language="1033">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyProgram" />
<Directory Id="ANOTHERLOCATION" />
</Directory>
</Directory>
<!-- The casing of 'ANOTHERLOCATION' and 'WindowsVolume' is very important here.
Replace 'MyNewDir' with the correct name of the folder you want on
WindowsVolume.
-->
<SetDirectory Id="ANOTHERLOCATION" Value="[WindowsVolume]MyNewDir" />
<Feature Id="DefaultFeature" Level="1">
<Component Directory="INSTALLDIR">
<File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" />
</Component>
<Component Directory="ANOTHERLOCATION">
<File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" />
</Component>
</Feature>
</Product>
</Wix>
Ok, you can do something like this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WindowsVolume">
<Directory Id="MyNewDirId" Name="MyNewDir">
<Component Id="SampleComponent" Guid="...">
<File Id="SampleFile" Source="..." KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
This will install the file to the MyNewDir folder on Windows drive (C: in my case).
However, it will complain that using WindowsVolume in this fashion might have unexpected side effects.
To satisfy that validation, you can change the sample to:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MyNewDirId" Name="MyNewDir">
<Component Id="SampleComponent" Guid="...">
<File Id="SampleFile" Source="..." KeyPath="yes" />
</Component>
</Directory>
</Directory>
<SetDirectory Id="MyNewDirId" Value="[WindowsVolume]MyNewDir" />
This looks more like a hack, but the result is the same.
To be honest, I don't understand what those "unexpected side effects" could be. Maybe, Windows Installer gurus can shed some light on this.
Hope this helps.