Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WiX:register.NET COM组件均为x86 x64_.net_Com_Wix_64 Bit - Fatal编程技术网

WiX:register.NET COM组件均为x86 x64

WiX:register.NET COM组件均为x86 x64,.net,com,wix,64-bit,.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"

我有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?

请尝试使用
regasm.exe
开关/x86和/x64


您还有32位和64位版本的
regasm.exe
,一个在
C:\windows\microsoft.net\\Framework
中,另一个在
Framework64
中,看看这是否有帮助。

安装两个文件副本,分别在
ProgramFiles64文件夹
ProgramFiles文件夹
下。浪费.5MiB,但很简单。

我通过使用两个组件,一个用于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>

...
...

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

编写CustomActions是一件痛苦的事情,让我怀疑它是否可以用于卸载或回滚。似乎我也需要执行
reg.exe
才能将值添加到HKLM.regasm.exe不支持/x86或/x64命令行开关。这是否要求您使用任何CPU编译.NET程序集?