2

I am having a problem very similar to the one described here: ProgramFiles64Folder is installing to \Program Files (x86)\ in WIX Installer

However, the solution there does not work for me. Wix still generates a .msi that installs to C:\Program Files (x86)

I placed the following code in my Product.wxs file:

<?if $(var.Platform) = x64 ?>
  <?define Win64 = "yes" ?>
  <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
  <?define ConfigFolder = "Release" ?>
<?else ?>
  <?define Win64 = "no" ?>
  <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
  <?define ConfigFolder = "Release_x86" ?>
<?endif?>

Then later I try to specify installation folder as follows:

<Directory Name="SourceDir" Id="TARGETDIR">
    <Directory Name="$(var.PlatformProgramFilesFolder)" Id="$(var.PlatformProgramFilesFolder)">
    ...

I verified that var.Platform is set properly because it copies source files from the correct ConfigFolder. However, it seems that both ProgramFiles64Folder and ProgramFilesFolder are set to C:\Program Files (x86)

I verified that candle.exe is invoked with -dPlatform=x64 option.

I even tried to specify platform in my Package tag

<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />

Nothing helps, it still tries to install to C:\Program Files (x86)

Any idea what else I can try?

Thank you.

I am using WiX version 3.9

Community
  • 1
  • 1
Alex Gdalevich
  • 685
  • 7
  • 15

5 Answers5

2

The following code fix the problem:

<CustomAction Id="Overwrite_WixSetDefaultPerMachineFolder" Property="WixPerMachineFolder"
    Value="[ProgramFiles64Folder][ApplicationFolderName]" Execute="immediate" />
<InstallUISequence>
    <Custom Action="Overwrite_WixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
</InstallUISequence>
<InstallExecuteSequence>
    <Custom Action="Overwrite_WixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
</InstallExecuteSequence>

BTW, I created a project to simplify the configuration of wix. Hope it can help: https://github.com/xinnj/WiXCover

1

It turned out that a different .wxs file was messing with WixPerUserFolder and other related variables.

Alex Gdalevich
  • 685
  • 7
  • 15
0

The only thing I can think of is that the components you are installing to that location are 32-bit components, so they get redirected to the x86 location. A 64-bit package can have 32 and 64-bit components, so you may need to mark them explicitly as Win64='yes'

PhilDW
  • 20,260
  • 1
  • 18
  • 28
0

Follow the sample in this blog and release a new 64 bit package and you will have your installation in Program Files folder. http://msdn.microsoft.com/en-us/library/gg513929.aspx

siva
  • 357
  • 4
  • 7
  • 17
0

Using WixUI_Advanced? This doesn't set the correct default folder on x64.

Workaround is to add this to the Product item:

        <!-- Workaround Wix Bug: https://github.com/wixtoolset/issues/issues/2165 -->
    <CustomAction Id="Overwrite_WixSetDefaultPerMachineFolder" Property="WixPerMachineFolder"
                    Value="[$(var.PlatformProgramFilesFolder)][ApplicationFolderName]" Execute="immediate" />
    <InstallUISequence>
        <Custom Action="Overwrite_WixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
    </InstallUISequence>
    <InstallExecuteSequence>
        <Custom Action="Overwrite_WixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
    </InstallExecuteSequence>
    <SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize" />

For the bug description and the workaround source look here:
https://github.com/wixtoolset/issues/issues/2165

  • It's better to include the gist of the information here instead of just a link. – Til Mar 07 '19 at 16:59