WiX:注册.NET COM组件x86 x64

时间:2012-06-29 16:15:18

标签: .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?

3 个答案:

答案 0 :(得分:0)

尝试regasm.exe开关/ x86和/ x64。

您还拥有32位和64位版本的regasm.exe,一个位于C:\windows\microsoft .net\<version>\Framework,另一个位于Framework64,看看是否有帮助。

答案 1 :(得分:0)

安装该文件的两个副本,分别位于ProgramFiles64FolderProgramFilesFolder下。浪费.5MiB,但很简单。

答案 2 :(得分:0)

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

<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 =&#34;是&#34; Attribut。我也不会复制文件。希望这会有所帮助,如果你有很多依赖,并且不会复制文件。