.net - WiX:同时注册 .NET COM 组件 x86 x64

标签 .net com wix 64-bit

我有 C# COM .dll。我想安装一次 .dll,但要为 x86 和 x64 注册它。

这是我仅用于注册 x64 的 WiX:

<Component Id="NETDLL.dll" Directory="INSTALLDIR">
  <File Id="NETDLL.dll" Name="NETDLL.dll" KeyPath="yes" Source="..\NETDLL.dll" />
  <Class Id="{78BE...}" Context="InprocServer32" Description="NETDLL" ThreadingModel="both" ForeignServer="mscoree.dll">
    <ProgId Id="NETDLL" Description="NETDLL" />
  </Class>
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32\1.0.1.0" Name="Class" Value="NETDLL" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32\1.0.1.0" Name="Assembly" Value="NETDLL, Version=1.0.1.0, Culture=neutral" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32\1.0.1.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32\1.0.1.0" Name="CodeBase" Value="file:///[#NETDLL.dll]" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32" Name="Class" Value="NETDLL" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32" Name="Assembly" Value="NETDLL, Version=1.0.1.0, Culture=neutral" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32" Name="CodeBase" Value="file:///[#NETDLL.dll]" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="Component Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Name="0" Value=".NET Category" Type="string" Action="write" />
  <RegistryKey Root='HKLM' Key='Software\NETDLL'>
    <RegistryValue Name='Description' Type='string' Value='NETDLL'/>
  </RegistryKey>
</Component>

如何一次性写入 HKCR\CLSID、HKCR\Wow6432Node\CLSID、HKLM\Software 和 HKLM\Software\Wow6432Node?

最佳答案

通过玩弄两个组件,一个用于 64 位,一个用于 x86 注册,我成功地在 64 位系统上为 x86 和 64 位注册了相同的 dll:

<Component Id="NETDLL.dll" Directory="INSTALLDIR" Guid="*">
   <Class Id="{78BE...}" Context="InprocServer32" Description="NETDLL"  
        ThreadingModel="both" ForeignServer="mscoree.dll">
      <ProgId Id="NETDLL" Description="NETDLL" />
   </Class>
   <File Id="NETDLL.dll" Name="NETDLL.dll" KeyPath="yes" 
          Source="..\NETDLL.dll" />
   <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\Implemented Categories {62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
   ...
</Component>
<Component Id="NETDLLWin64.dll" Guid="{885F75B1-3046-42BD-8B37-F8FA0E8D7A51}" Win64="yes" Directory="INSTALLDIR">
   <Class Id="{78BE...}" Context="InprocServer32" Description="NETDLL" ThreadingModel="both" ForeignServer="mscoree.dll">
      <ProgId Id="NETDLL" Description="NETDLL" />
   </Class>
   <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />  
   ...
</Component>

我加了 指导 - 组件节点中的属性,更改了第二个组件的 Id 并添加了 Win64="是"属性。另外我不复制文件。希望这会有所帮助,如果您有很多依赖项并且不会复制文件。

关于.net - WiX:同时注册 .NET COM 组件 x86 x64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11265380/

相关文章:

windows - COM 服务器 DLL 依赖项的搜索规则

c# - 构建一个可以使用多种配置多次安装相同包(到不同文件夹)的安装程序

.net - "Noisy"日志记录问题

c# - 是否可以将 .NET 类转换为 COM 库类?

c# - C# 中的三元运算符关联性——我可以依赖它吗?

c# - 我可以将 PHP 关联数组传递给 ComVisible .NET 函数吗?

wix - 在哪里可以找到 Microsoft.Tools.WindowsInstallerXml.dll?

installation - 如何安排使用MSI在下次重新启动时进行安装?

.net - 通过类名实例化 .Net 对象

.net - 哪个字符串转换器以及何时以及为什么?