gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 17:56:05 24 4
gpt4 key购买 nike

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com