在自定义操作中更改组件的 Win64 属性

Changing Win64 attribute of component in custom action

我正在尝试为 outlookaddin 添加注册表值。由于注册表目标由outlookarchitecture/bitness决定,我需要在[=的基础上设置组件组件Win64属性 19=]outlook 的架构 我有一个自定义操作来确定它的架构。

这是wix的片段

  <Component Id="Registry" Guid="446A9B40-1C57-4D51-BF81-4EAD54A44BD7" Directory="OutLookAddInFolder" Win64="no" ><!--Set the value of Win64 on the basis of outlook bitness-->
    <RegistryKey  Root="HKMU" Key="Software\Microsoft\Office\Outlook\Addins\MyAddIn"  ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes" >
      <RegistryValue Name="FriendlyName" Action="write" Value="Name" Type="string" KeyPath="yes"   />
      <RegistryValue Name="Description" Action="write" Value="Description" Type="string" KeyPath="no" />
      <RegistryValue Name="LoadBehavior" Action="write" Value="3" Type="integer" KeyPath="no" />
    </RegistryKey>
  </Component>

有没有办法在自定义操作中或在安装过程中以某种方式执行此操作?

根据我的经验,正常的做法是拥有组件的两份副本,一份 64 位和一份 32 位(显然不同的 ID),并给每个条件一个条件,一个与其他。你没有说你是如何决定位数的,但我看到人们对 Office 信息进行注册表搜索和组件搜索,并使用它来设置 属性。

根据定义,您必须构建 64 位 MSI(因为 32 位 MSI 必须仅包含 32 位组件):

https://msdn.microsoft.com/en-us/library/windows/desktop/aa367451(v=vs.85).aspx

因此,如果您希望单个 MSI 支持两者,那么同时提供可用选项和条件选项都可以,如果搜索找到您的 64 位 Outlook 项目,则可能不需要任何代码或自定义操作。