Reputation: 99
I want to create two subdirectories under [WindowsVolume]MyNewDir. SubDir1 and SubDir2. How I achieve that. Below is my 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>
<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>
Upvotes: 0
Views: 67
Reputation: 3413
You need to define the base directory, in this case WindowsVolume, from there you can create any directory structure that will be created with your installer, then you can reference the new directories to put your files there.
Try this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyProgram" />
</Directory>
<Directory Id="WINDOWSVOLUME" >
<Directory Id="ANOTHERLOCATION" Name="MyNewDir">
<Directory Id="DIR1" Name="SubDir1" />
<Directory Id="DIR2" Name="SubDir2" />
</Directory>
</Directory>
</Directory>
</Directory>
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]" />
<Feature Id="DefaultFeature" Level="1">
<Component Directory="INSTALLDIR">
<File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" />
</Component>
<Component Directory="DIR1">
<File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" />
</Component>
</Feature>
Upvotes: 1