基于WIX的安装程序如何为32位和64位Windows操作系统进行COM注册?

Kev*_*evM 5 windows-installer wix

我有一个长期存在的安装程序,它使用RegistryValue来设置.Net COM服务器.安装程序是32位.我想为64位操作系统设置注册表设置.我的研究表明,为此,我需要一个单独的64位安装程序.那么我怎么能有一个检测OS的引导程序并调用正确的32位或64位.msi?

小智 10

我在自定义Windows Shell Overlay Extension中遇到了同样的问题,它必须为32位Windows提供32位Dll,为64位Windows提供64位Dll.我的32位msi文件只会将注册表项写入64位系统上的WoW6432节点,因此shell扩展不起作用.

解决方案(在Win7 x86和x64上使用wix-3.5.2519.0进行测试):

  1. 创建两个组件,一个将仅安装在32位系统上,另一个仅安装在64位系统上.
  2. 在每个Component中使用'Condition'元素来检查操作系统的位数.我使用过Msix64,它也可以和VersionNT64一起使用...
  3. 64位组件必须将Win64属性设置为"是".
  4. 不幸的是,这不会成功开箱即用,因为light.exe会抛出错误(错误LGHT0204:ICE80:此软件包包含64位组件,但模板摘要属性不包含Intel64或x64.):
  5. 解决方案是在禁用ICE80检查的情况下运行light.exe(使用参数-sice:ICE80).现在将生成msi文件,并且可以在两个平台上使用.

例:

<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>
Run Code Online (Sandbox Code Playgroud)

参考文献:


Cos*_*rvu 4

您需要自己编写引导程序。

WiX 不支持混合 32/64 位软件包,因为 Windows Installer 不支持它们。但是,一些商业工具使用自定义引导程序和 2 个 MSI 文件来处理混合安装程序。