它似乎并不适用于所有人,因此,我将描述我为使其工作所做的工作 .
2)在 BHO.cs 修改 RegisterBHO(...) 方法
从:
RegistryKey ourKey = registryKey.OpenSubKey(guid);
至:
RegistryKey ourKey = registryKey.OpenSubKey(guid, true); //we want to write the registry
3)为 AnyCPU 编译项目:项目属性,为平台目标选择AnyCPU .
4)创建一个这样的.bat,适应你的路径,并将你的输出dll复制到一边:
"c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
这将注册x86和x64的dll . 这是 mandatory 以使两个版本都注册,否则IE赢得't like it (it will complain the extension is '不兼容') because it won' t能够启动它取决于您的IE设置 . 注意我想你可以为每个版本提供两个不同的文件,但.NET _3020313需要它 .
5)运行.bat作为管理员,这是我这样做时的输出:
"c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
Microsoft .NET Framework Assembly Registration Utility version 4.7.2046.0
for Microsoft .NET Framework version 4.7.2046.0
Copyright (C) Microsoft Corporation. All rights reserved.
RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully
"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
Microsoft .NET Framework Assembly Registration Utility version 4.7.2046.0
for Microsoft .NET Framework version 4.7.2046.0
Copyright (C) Microsoft Corporation. All rights reserved.
RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully
6)运行 iexplore.exe . 它可能会工作取决于您的设置(显示"HOLA!!!"消息框),但无论如何,转到菜单工具/ Internet选项/程序/管理加载项,这是我看到的:
如果禁用了扩展,您应该能够启用它(并重新启动) .
如果它不起作用(默认情况下不应该),请确保已选中“为增强保护模式*启用64位进程”(需要重新启动) . 对我来说消息是错误的,它应该只是说“启用64位进程”......