I have a long lived installer which is using RegistryValue to setup a .Net COM server. The installer is 32 bit. I would like to have the regis开发者_开发知识库try settings also set for 64 bit OSes. My research shows that I need to have a separate 64 bit installer for this purpose. Fine how can I then have a bootstrapper which detects the OS and invokes the correct 32 or 64 bit .msi?
I had the same problem with a custom Windows Shell Overlay Extension that must provide a 32-bit Dll for 32-bit Windows and a 64-bit Dll for 64-bit Windows. My 32-bit msi file would only write the registry entries to the WoW6432 node on the 64-bit system, so the shell extension didn't work.
The solution (tested with wix-3.5.2519.0 on Win7 x86 and x64):
- Create two components, one will install only on a 32-bit System and the other one will only install on a 64-bit System.
- Use a 'Condition' element inside each Component to check for the bitness of the operating system. I used Msix64, it might also work with VersionNT64...
- The 64-bit Component must have the Win64 Attribute set to "yes".
- Unfortunately this will not work successfully out of the box because light.exe throws an error (error LGHT0204 : ICE80: This package contains 64 bit component but the Template Summary Property does not contain Intel64 or x64.):
- The solution is to run light.exe with the ICE80 check disabled (use parameter -sice:ICE80). Now the msi file will be generated and can be used on both platforms.
Example:
<Component Id="shellext_32.dll" DiskId="1" Guid="YOUR-GUID1">
<!-- this will be installed only on a 32-bit System-->
<Condition><![CDATA[NOT Msix64]]></Condition>
<!-- copy 32-bit Dll file...-->
<File Id="blah blah... />
<RegistryKey Id="MyShellIconOverlay" Root="HKLM"Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\MyIconOverlay" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Value="{GUID...}" />
</RegistryKey>
</Component>
<Component Id="shellext_64.dll" DiskId="1" Guid="YOUR-GUID2" Win64="yes">
<!-- this will be installed only on a 64-bit System-->
<Condition><![CDATA[Msix64]]></Condition>
<!-- copy 64-bit Dll file...-->
<File Id="blah blah... />
<!-- the following Registry Key will NOT be created inside the WoW6432
<RegistryKey Id="MyShellIconOverlay64" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\MyIconOverlay64" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Value="{GUID...}" />
</RegistryKey>
</Component>
References:
- http://jpassing.com/2009/10/09/mixing-32-and-64-bit-components-in-a-single-msi/
- http://installing.blogspot.com/2006/04/msi-validation-in-wix.html
You would need to write the bootstrapper yourself.
WiX doesn't support mixed 32/64-bit packages because Windows Installer doesn't support them. However, some commercial tools use a custom bootstrapper and 2 MSI files to handle a mixed installer.
精彩评论