I am trying to create one installer (one MSI file) for both x86 and x64. I would like the installation process to install only relevant files based on the target machine platform. Till now I had one only MSI for x86 and it worked as expected. Now I added this section:
<!-- Details to support both x86 and x64 platforms-->
<?if $(var.Platform) = x64 ?>
<?define ProductName = "MyApp (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define ExportReleaseComponentGroup = "Export64ReleaseComponentGroup" ?>
<?define MyApplication = "$(var.x64SourcePath)\MyApp.exe" ?>
<?else ?>
<?define ProductName = "MyApp" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define ExportReleaseComponentGroup = "Export32ReleaseComponentGroup" ?>
<?define MyApplication = "$(var.win32SourcePath)\MyApp.exe" ?>
<?endif ?>
Now I get some errors:
In a x64 machine it is installed under Program Files (x86) folder. I am compiling the SetupProject in x86, can it be the reason for that? relevant code:
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="$(var.PlatformProgramFilesFolder)">
The application does not run when installation ends. relevant code:
<!--CA to launch the exe after install--> <Property Id="WixShellExecTarget" Value="$(var.MyApplication)" /> <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
A desktop shortcut and a start menu shortcut is not created. relevant code:
<Component Id="ProgramFilesShortcut" Guid="{My-Guid}"> <Condition>MY_DESKTOP_SHORTCUT</Condition> <Shortcut Id="desktopMyApp" Directory="DesktopFolder" Name="MyApp" Target="$(var.MyApplication)" WorkingDirectory="bin" Icon="MyIcon.ico"> </Shortcut> <RemoveFolder Id="ProgramFilesShortcut" On="uninstall" /> <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="installed" Type="integer" Value="1" KeyPath="yes" /> </Component> <Component Id="ProgramMenuDir" Guid="{My-Guid}"> <Shortcut Id="startmenuMyApp" Directory="ProgramMenuFolder" Name="MyApp" Target="$(var.MyApplication)" Icon="MyIcon.ico" WorkingDirectory="bin" Arguments="-s"> <!-- Set the AppID in order to get toasts to work --> <ShortcutProperty Key="System.AppUserModel.ID" Value="MyCompany.MyApp" /> </Shortcut> <RemoveFolder Id="ProgramMenuDir" On="uninstall" /> <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="installed" Type="integer" Value="1" KeyPath="yes" /> </Component>
Any idea what am I doing wrong?