wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 24 forks source link

WixUI_Advanced: x64 package installed to "C:\Program Files(x86)" #5908

Open alexhass opened 5 years ago

alexhass commented 5 years ago

Triage

WixUI_Advanced hardcodes all applications to x86 program files folder. No way to change this to x64.

`

`

Bugs

If this issue is a bug:

  • Which version of WiX are you building with?

3.11.1

  • Which version of Visual Studio are you building with (if any)?

None

  • Which version of the WiX Toolset Visual Studio Extension are you building with (if any)?

None

  • Which version of .NET are you building with?

None

  • If the problem occurs when installing your packages built with WiX, what is the version of Windows the package is running on?

Windows 10 R1809

  • Describe the problem and the steps to reproduce it.
  1. Build MSI with WixUI_Advanced.
  <?if $(env.Platform)=x86?>
    <?define ProgramFilesFolder="ProgramFilesFolder" ?>
    <?define Win64="no" ?>
    <?define Arch="(x86)" ?>
  <?else?>
    <?define ProgramFilesFolder="ProgramFiles64Folder" ?>
    <?define Win64="yes" ?>
    <?define Arch="(x64)" ?>
  <?endif?>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="$(var.ProgramFilesFolder)">
...
  • Describe the behavior you expected and how it differed from the actual behavior.

Setup defaults to C:\Program Files (x86), but should default to C:\Program Files

alexhass commented 5 years ago

Hack around this bug:

<?if $(env.Platform)=x86?>
  <?define ProgramFilesFolder="ProgramFilesFolder" ?>
  <?define Win64="no" ?>
  <?define Arch="(x86)" ?>
<?else?>
  <?define ProgramFilesFolder="ProgramFiles64Folder" ?>
  <?define Win64="yes" ?>
  <?define Arch="(x64)" ?>
<?endif?>

<!-- WixUI_Advanced defaults to "[ProgramFilesFolder][ApplicationFolderName]" what is wrong for x64 applications. Fix the path with an override. https://github.com/wixtoolset/issues/issues/5908 -->
<CustomAction Id="WixSetDefaultPerMachineFolderPerArch" Property="WixPerMachineFolder" Value="[$(var.ProgramFilesFolder)][ApplicationFolderName]" Execute="immediate"/>

<InstallExecuteSequence>
  <Custom Action="WixSetDefaultPerMachineFolderPerArch" Before="WixSetPerMachineFolder" />
</InstallExecuteSequence>
<InstallUISequence>
  <Custom Action="WixSetDefaultPerMachineFolderPerArch" Before="WixSetPerMachineFolder" />
</InstallUISequence>
stephenlepisto commented 3 months ago

This is still an issue in WixToolset.UI.wixext v5.0.1 (installed in Visual Studio 2022 with NuGet). The above work-around addressed the problem in my case (dropping into my definition), although I had to change the first line from <?if $(env.Platform)=x86?> To <?if $(var.Platform)=x86?> Apparently because I'm using WiX v5.