我使用SharpShell为Windows资源管理器shell构建了一个ContextMenuHandler . 该程序集是为AnyCPU构建的,即在MSIL中构建,因此可以作为32位和64位运行 .
我打算只在64位窗口上运行它,但是,Windows 64上的32位应用程序仍然使用32位版本的shell进行打开对话框等 .
我已经在两个体系结构(32和64)上使用regasm工具手动注册了此程序集,并且它在64位Windows资源管理器中工作正常 . 它也适用于32位应用程序中的文件打开和其他shell提供的对话框 . 这是预期的行为,太棒了!
我遇到的问题是编写安装脚本,我正在使用Wix 3.7并且我不想使用regasm .
64位组件安装时: -
<Component Id="cmpMyAssembly64" Directory="INSTALL_TO_HERE"
Location="local" Win64="yes">
<File Id="filMyAssembly" KeyPath="yes" Source="mySource.dll"
Assembly=".net" AssemblyApplication="filMyAssembly"
ProcessorArchitecture="msil"/>
<Class Id="01201201-0000-0000-0000-012345670123" Description="My Handler"
Context="InprocServer32" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="A.ContextHandler" Description="Does something" />
</Class>
<RegistryKey Root="HKCR" Key="CLSID\{01201201-0000-0000-0000-012345670123}"
ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryKey Key="Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}">
<RegistryValue Value="" Type="string" />
</RegistryKey>
<RegistryKey Key="InprocServer32">
<RegistryKey Key="1.0.0.0">
<RegistryValue Name="Class" Value="aNamespace.theClass" Type="string" />
<RegistryValue Name="Assembly" Value="!(bind.assemblyFullName.filMyAssembly)" Type="string" />
<RegistryValue Name="RuntimeVersion" Value="v4.0.30319" Type="string" />
<RegistryValue Name="CodeBase" Value="file:///[#filMyAssembly]" Type="string" />
</RegistryKey>
<RegistryValue Name="Class" Value="aNamespace.theClass" Type="string" />
<RegistryValue Name="Assembly" Value="!(bind.assemblyFullName.filMyAssembly)" Type="string" />
<RegistryValue Name="RuntimeVersion" Value="v4.0.30319" Type="string" />
<RegistryValue Name="CodeBase" Value="file:///[#filMyAssembly]" Type="string" />
</RegistryKey>
</RegistryKey>
<RegistryValue Root="HKCR" Key="Directory\Background\shellex\ContextMenuHandlers\MyHandler" Value="{guid}" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="Directory\shellex\ContextMenuHandlers\MyHandler" Value="{guid}" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="Drive\shellex\ContextMenuHandlers\MyHandler" Value="{guid}" Type="string" Action="write" />
</Component>
我遇到的问题是32位版本的注册 . 因为它使用相同的程序集,所以我不想两次安装相同的文件 . 我所做的就是创建另一个(32位)组件并进行必要的注册表更改 .
<Component Id="cmp32BitVersion" Directory="INSTALL_TO_32"
Location="local" Win64="no">
<Class ... just like 64bit
<RegistryKey ... just like 64bit
</Component>
现在,我假设Win64是/否是Windows安装程序决定写入哪个部分的注册表 . 对于64位组件,它写入HKCR ...,对于32位组件,它将写入HKLM \ SOFTWARE \ WOW6432Node \ Classes . 我遇到的问题是,因为两个组件都使用文件引用[#filMyAssembly]我得到ICE69:不匹配的组件引用,警告 . 代码仍然构建,但我不希望得到警告,不注意警告的人应该预料到麻烦 .
无论如何,我的问题是:使用Wix / Windows Installer在64位和32位应用程序中为COM注册MSIL程序集的正确方法是什么?
1 回答
来自wix用户的MikeR和nickheppleston看起来已经找到了解决方案:
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/64-bit-and-32-bit-Registry-Keys-in-same-MSI-td4439679.html