Search code examples
windowswixwindows-installermsys2wix5

MSI created with WIX Toolset installs under C:\Program Files (x86)\


I have created a MSI installer for reSLIRP, but it installs the application under C:\Program Files (x86), instead of under C:\Program Files.

Everything I have found googling has not worked. For instance, setting Wix/Package/@Platform="x64" and/or .../Componet/@Win64="yes", does not work. Those options seem to be for older version of Wix and are not accepted anymore. I have set Bitness="always64" which seems to be the modern approach but it does nothing.

This is the WXS code:

<?xml version="1.0"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <Package Compressed="yes" InstallerVersion="500" Manufacturer="HappyRobotsLTD" Name="reSLIRP" Scope="perMachine" UpgradeCode="12345678-ABCD-0001-0001-250131143054" Version="1.1.0.0">
    <StandardDirectory Id="ProgramFiles64Folder">
      <Directory Id="INSTALLFOLDER" Name="reSLIRP">
        <Component Bitness="always64" Id="ProductComponent">
          <File Id="MainExecutable" KeyPath="yes" Source="build\reslirp.exe"/>
        </Component>
        <Component Bitness="always64" Id="msys_intl_8_dll">
          <File Id="msys_intl_8_dll" KeyPath="yes" Source="C:\msys64\usr\bin\msys-intl-8.dll"/>
        </Component>
        <Component Bitness="always64" Id="msys_glib_2_0_0_dll">
          <File Id="msys_glib_2_0_0_dll" KeyPath="yes" Source="C:\msys64\usr\bin\msys-glib-2.0-0.dll"/>
        </Component>
        <Component Bitness="always64" Id="msys_stdc_6_dll">
          <File Id="msys_stdc_6_dll" KeyPath="yes" Source="C:\msys64\usr\bin\msys-stdc++-6.dll"/>
        </Component>
        <Component Bitness="always64" Id="msys_iconv_2_dll">
          <File Id="msys_iconv_2_dll" KeyPath="yes" Source="C:\msys64\usr\bin\msys-iconv-2.dll"/>
        </Component>
        <Component Bitness="always64" Id="msys_gcc_s_seh_1_dll">
          <File Id="msys_gcc_s_seh_1_dll" KeyPath="yes" Source="C:\msys64\usr\bin\msys-gcc_s-seh-1.dll"/>
        </Component>
        <Component Bitness="always64" Id="msys_2_0_dll">
          <File Id="msys_2_0_dll" KeyPath="yes" Source="C:\msys64\usr\bin\msys-2.0.dll"/>
        </Component>
        <Component Bitness="always64" Id="msys_pcre2_8_0_dll">
          <File Id="msys_pcre2_8_0_dll" KeyPath="yes" Source="C:\msys64\usr\bin\msys-pcre2-8-0.dll"/>
        </Component>
        <Component Bitness="always64" Id="msys_slirp_0_dll">
          <File Id="msys_slirp_0_dll" KeyPath="yes" Source="C:\msys64\usr\local\bin\msys-slirp-0.dll"/>
        </Component>
      </Directory>
    </StandardDirectory>
    <Feature Id="reSLIRPFeature">
      <ComponentRef Id="ProductComponent"/>
      <ComponentRef Id="msys_intl_8_dll"/>
      <ComponentRef Id="msys_glib_2_0_0_dll"/>
      <ComponentRef Id="msys_stdc_6_dll"/>
      <ComponentRef Id="msys_iconv_2_dll"/>
      <ComponentRef Id="msys_gcc_s_seh_1_dll"/>
      <ComponentRef Id="msys_2_0_dll"/>
      <ComponentRef Id="msys_pcre2_8_0_dll"/>
      <ComponentRef Id="msys_slirp_0_dll"/>
    </Feature>
  </Package>
</Wix>

Note that the project is compiled using msys2 (with the Linux/Unix emulation layer). The generated executables are x86_64:

$ file /c/Program\ Files\ \(x86\)/reSLIRP/reslirp.exe
/c/Program Files (x86)/reSLIRP/reslirp.exe: PE32+ executable for MS Windows 5.02 (console), x86-64, 18 sections

Any idea about what could I be doing wrong?


Solution

  • Don't do any of those things. They were bad suggestions, even in WiX v3.

    In your .wixproj, set the Platform property to x64. The bitness of the output is a project-level setting, not a source code-level setting. In the same way, the output name is a project-level setting, not a source code-level setting.