WiX:同时注册 .NET COM 组件 x86 x64 [英] WiX: register .NET COM component both x86 x64

查看:37
本文介绍了WiX:同时注册 .NET COM 组件 x86 x64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have C# COM .dll. I would like to install the .dll once, but have it be registered for both x86 and x64.

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

Here's the WiX I have for registering only x64:

<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...}InprocServer321.0.1.0" Name="Class" Value="NETDLL" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID{78BE...}InprocServer321.0.1.0" Name="Assembly" Value="NETDLL, Version=1.0.1.0, Culture=neutral" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID{78BE...}InprocServer321.0.1.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
  <RegistryValue Root="HKCR" Key="CLSID{78BE...}InprocServer321.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='SoftwareNETDLL'>
    <RegistryValue Name='Description' Type='string' Value='NETDLL'/>
  </RegistryKey>
</Component>

如何一次性写入HKCRCLSID、HKCRWow6432NodeCLSID、HKLMSoftware、HKLMSoftwareWow6432Node?

How can I write in HKCRCLSID, HKCRWow6432NodeCLSID, HKLMSoftware, and HKLMSoftwareWow6432Node all at once?

推荐答案

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

I succeeded registering the same dll on a 64 Bit System for x86 and 64bit by playing around with two Components, one for the 64bit and one for the x86 Registration:

<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>

我在组件节点中添加了 Guid-Attributes,更改了第二个组件的 Id 并添加了 Win64="yes" 属性.我也不复制文件.希望这会有所帮助,如果您有很多依赖项并且不会复制文件.

I added Guid-Attributes in the Component Node, changed the Id for the second Component and added the Win64="yes" Attribut. Also I don't duplicate the File. Hope this helps, if you have a lot of dependencies and won't duplicate the Files.

这篇关于WiX:同时注册 .NET COM 组件 x86 x64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆