繁体   English   中英

解决插件中混合模式DLL的引用程序集

[英]Resolving referenced Assemblies for mixed-mode DLL in a plugin

因此,我有一个用于Internet Explorer的托管BHO,该BHO加载了一个本机DLL,该本地DLL依赖于混合模式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.

因此,似乎只在应用程序目录中查找,我认为这是有道理的。 我认为必须有一种方法可以使它在我的安装目录中显示,但是我不确定如何。 更改当前工作目录无济于事。 有任何想法吗?

因此,我找到了AppDomain.CurrentDomain.AssemblyResolve ,它似乎对我有用 不知道这是否是执行此操作的最佳方法,因此我仍然愿意接受其他答案:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM