0

I created an MSI using WIx installer and its default installation location is showing as Program files instead of Program Files (x86)

App created in Visual studio Release mode x64

 Wix Code snippet 

    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Manufacturer="X Tec" Description="Version 1.0" Comments="(C) 2020 X Tec" Platform="x64"/>

  <Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFiles64Folder">
    <Directory Id="MANUFACTURERDIR" Name="X Tec">

As "ProgramFiles64Folder" is give it should go in Program Files (x86), Do i miss something

Sijith
  • 3,740
  • 17
  • 61
  • 101

2 Answers2

2

Sample below, make sure your component is marked as 64-bit:

The construct: $(env.SystemRoot) - in the WiX source below - gets the environment variable %SystemRoot% - which resolves to C:\ on most systems (to list environment variables open a cmd.exe and type set and press Enter). The below source should hence compile on all systems without modifications (except you need to add a GUID for the UpgradeCode attribute):

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Product Id="*" Name="Sample" Language="1033" Version="1.0.0"
           Manufacturer="." UpgradeCode="PUT-GUID-HERE">
    <Package InstallerVersion="200" Compressed="yes"
             InstallScope="perMachine" Platform="x64" />

    <MediaTemplate EmbedCab="yes" />

    <Feature Id="MainFeature" Title="MainFeature" Level="1" />
    
    <Directory Id="TARGETDIR" Name="SourceDir">

      <Directory Id="ProgramFiles64Folder">
        <Directory Id="MainApplicationFolder" Name="Main Application Folder">

          <!-- Using notepad.exe as sample file should compile on all systems -->
          <Component Feature="MainFeature" Win64="yes">
            <File Source="$(env.SystemRoot)\notepad.exe" />
          </Component>

        </Directory>
      </Directory>
    </Directory>

  </Product>
</Wix>

Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
0

This is exactly how it should work. In a 64-bit Windows installation, the "Program Files" directory is where 64-bit applications should be installed. The "Program Files (x86)" directory is for 32-bit applications. The only time a 32-bit application should be installed into the "Program Files" directory is on a 32-bit Windows installation. In that case, because all applications are 32-bit there is no need for a "Program Files (x86)" directory.

In summary:

OS Version 64-bit Applications 32-bit Applications
64-bit Windows C:\Program Files C:\Program Files (x86)
32-bit Windows (n/a) C:\Program Files

See also: https://answers.microsoft.com/en-us/windows/forum/all/programs-files-vs-program-files-x86/7d631676-e688-472a-a1bb-eefccfeca6d7