所以我有一个用于Internet Explorer的托管BHO,它加载了一个本机DLL,它依赖于混合模式DLL,依赖于另一个托管DLL。
所以依赖关系基本上是这样的:
IE.BHO.dll (Managed DLL)
|-> IE.Hook.dll (Native DLL)
|-> Core.Communication.CPP.dll (Mixed-Mode dll)
|-> Core.Communication.dll (Managed DLL)
我已经加载了IE.Hook.dll,它在Core.Communication.CPP.dll中实例化了一个类。但是一旦Core.Communication.CPP.dll尝试使用Core.Communication.dll中的代码,我就会收到一个FileNotFoundException,说它无法找到Core.Communication程序集。
它们都位于同一目录中。 Core.Communication.dll也依赖于protobuf-net,它也位于同一目录中。
我需要做些什么才能确保混合模式DLL可以加载托管DLL?
更新
Fusion Log显示:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = Core.Communication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Internet Explorer/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Internet Explorer/Core.Communication.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Internet Explorer/Core.Communication/Core.Communication.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Internet Explorer/Core.Communication.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Internet Explorer/Core.Communication/Core.Communication.EXE.
所以它似乎只是在应用程序目录中查找,我想这是有道理的。我假设必须有一种方法让它在我的安装目录中查找,但我不知道如何。更改当前工作目录没有帮助。有什么想法吗?