Alex Gdalevich
Alex Gdalevich

Reputation: 687

Wix ProgramFiles64Folder is still

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

Upvotes: 2

Views: 5926

Answers (5)

Michael Xin
Michael Xin

Reputation: 71

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

Upvotes: 2

Nils Jeisecke
Nils Jeisecke

Reputation: 11

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

Upvotes: 0

Alex Gdalevich
Alex Gdalevich

Reputation: 687

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

Upvotes: 1

siva
siva

Reputation: 377

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

Upvotes: 0

PhilDW
PhilDW

Reputation: 20780

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'

Upvotes: 0

Related Questions