2

I have a special situation I need to find a workaround for. I have an wix installer for my 32-bit application, but it has a dependency on an office document file that must go in a fixed place under the "Program Files" folder regardless of 32/64 bit windows versions. Please for a moment just accept that its location cannot be changed due to preserving backwards compatibility for an app that has been around since the XP days. I need to install my app in the "Program Files (x86)" folder as well as deliver this file that must reside in "Program Files". I do not want to split them into two installers if at all possible. Anyone know of any possible way to make this work?

PhilDW
  • 20,260
  • 1
  • 18
  • 28
Jason Rodman
  • 71
  • 1
  • 5

2 Answers2

1

You should be able to include "ProgramFiles64Folder" in your directory definition and then use that dir as the directory for the components that need to go into the 64-bit location.

You'll likely have to include two components which duplicate the same files where one component installs into the "C:\Programs Files" on a 64-bit machine and the other one installs into "C:\Programs Files" on a 32-bit machine.

I do something like this with some snmp related files. An example of what I mean:

<ComponentGroup Id="Files_32" Directory="OfficeProgramFilesFolder">
    <Component Id="SomeFile.dll_32" >
        <Condition>NOT VersionNT64</Condition>
        <File Id="SomeFile.dll_32" KeyPath="yes" Source="$(var.BinariesDir)\_bin\Win32\SomeFile.dll" />
    </Component>
</ComponentGroup>
<ComponentGroup Id="Files_64" Directory="OfficeProgramFiles64Folder">
    <Component Id="SomeFile.dll_64" Win64="yes">
        <Condition>VersionNT64</Condition>
        <File Id="SomeFile.dll_64" KeyPath="yes" Source="$(var.BinariesDir)\_bin\x64\SomeFile.dll" />
    </Component>
</ComponentGroup>

This should install the file into the "C:\Program Files" whether it is a 32-bit or 64-bit machine.

You will get an ICE warning if the file is exactly the same between the 64-bit and 32-bit components but it is okay because they are mutually exclusive.

Brian Sutherland
  • 4,698
  • 14
  • 16
1

Attempts to install into 64-bit folders from a 32-bit MSI install result in redirection to the 32-bit location, this appears in a log of the install with this kind of entry:

WIN64DUALFOLDERS: 'C:\Program Files (x86)\' will substitute 17 characters in 'C:\Program Files\Wi......

PROPERTY CHANGE: Modifying TARGETDIR property. Its current value is 'C:\Program Files\Wilson\NewSetup'. Its new value: 'C:\Program Files (x86)\Wilson\NewSetup\'.

32-bit packages can contain only 32-bit components, the docs are explicit about that.

If there is one file that needs to be delivered to the 64-bit Program Files location then the usual fix is to have something in the application that copies it to that location the first time it runs. 32-bit apps can temporarily disable the redirection by calling Wow64DisableWow64FsRedirection().

As it says here, if you've not seen it yet:

https://blogs.msdn.microsoft.com/heaths/2008/01/15/different-packages-are-required-for-different-processor-architectures/

and a 64-bit app (that can also contain 32-bit components) would solve the problem, which I suspect you already know.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • Then what to do if I am content with the installer being strictly 64-bit, but still want to install some files in 'Program Files' and some files in 'Program Files (x86)'? Is this also impossible? – Mike Rosoft Mar 15 '21 at 13:52