我使用SharpShell为Windows Explorer shell构建了一个ContextMenuHandler。该程序集是以AnyCPU构建的,即以MSIL编写,因此可以在32位和64位上运行。
虽然我打算仅在64位Windows上运行它,但是在Windows 64上,32位应用程序仍然使用32位版本的shell进行打开对话框等操作。
我已经使用regasm工具在两种体系结构(32位和64位)上手动注册了这个程序集,并且在64位Windows资源管理器中正常工作。它还可以在32位应用程序的文件打开和其他shell提供的对话框中工作。 这是预期的行为,很好!
我遇到的问题是编写安装脚本,我正在使用Wix 3.7,但我不想使用regasm。
64位组件的安装方式如下:
我遇到的问题是32位版本的注册。由于它使用相同的程序集,我不想重复安装同一个文件。我只需要创建另一个(32位)组件并进行必要的注册表更改。
现在,我认为Win64的是/否是Windows Installer决定写入哪部分注册表的方式。对于64位组件,它会写入HKCR...,对于32位组件,它会写入HKLM\SOFTWARE\WOW6432Node\Classes。我的问题是,因为两个组件都使用文件引用[#filMyAssembly],我正在收到ICE69: Mismatched component reference警告。代码仍然可以构建,但我更喜欢不收到警告,不遵守警告的人应该准备好有麻烦。
虽然我打算仅在64位Windows上运行它,但是在Windows 64上,32位应用程序仍然使用32位版本的shell进行打开对话框等操作。
我已经使用regasm工具在两种体系结构(32位和64位)上手动注册了这个程序集,并且在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 Installer决定写入哪部分注册表的方式。对于64位组件,它会写入HKCR...,对于32位组件,它会写入HKLM\SOFTWARE\WOW6432Node\Classes。我的问题是,因为两个组件都使用文件引用[#filMyAssembly],我正在收到ICE69: Mismatched component reference警告。代码仍然可以构建,但我更喜欢不收到警告,不遵守警告的人应该准备好有麻烦。
无论如何,我的问题是:使用Wix/Windows Installer,在64位和32位应用程序中注册MSIL程序集的正确方法是什么?