【发布时间】:2016-04-22 08:52:02
【问题描述】:
好的,所以我已经成功地为我的可执行文件的插件设置了我的Private Assembly,例如described here:(这只是一个示例,我的用例在技术上是相同的,但对于插件来说不是这样。)
- 可执行文件使用应用程序清单在
plugins程序集上声明dependentAssembly -
plugins子目录包含plugins.manifest -
plugins.manifest声明assemblyIdentity和files列出插件 DLL(例如,easyplug1.dll和xplug2.dll)
我不太明白,也没有找到任何直接解释,私有程序集中的 DLL 所依赖的 DLL 是什么?它们应该位于哪里,如何找到它们?
示例:xplug2.dll,它本身就是 3rd 方需要 3rd 方 dll xbase.dll。当然,xbase.dll 也简单地部署在 plugins 目录中。这够了吗? 私有程序集是否需要列出仅由(可执行)模块传递使用的 DLL,以声明其对 plugins 程序集的依赖关系?
到目前为止的部分答案通过反复试验:
(A) 似乎 所有 DLL,以及那些仅从其他“插件”DLL 中使用的 DLL 必须列在 Private Assembly 清单中——即基本上应该列出 所有 plugins 程序集目录中的 DLL 文件。
(A.1) 任何未列出的 DLL 将不会在目录中找到,即使它是从同一子目录中的 DLL 引用的。
(A.2) 我假设这是由于所有 DLL 加载机制使用来自可执行文件的(仅)自定义 Activation Context,如果在其中找不到 DLL,它似乎从可执行目录中搜索。
(A.3) 我尝试使用 the latest version 的 Dependency Walker (2.2.10011) 查看依赖链,但它似乎根本无法处理这种传递场景:主要依赖关系显示正确,但是传递的次要依赖不是从清单中解析的,而是相对于基目录。 (似乎它遵循plain LoadLibrary semantics for the transient ones.)
文件布局:
...\base\app.exe
// - contains Application Manifest declaring dependency on `plugins`
// - Loads xplug2.dll
...\base\plugins\xplug2.dll
// - Loads xbase.dll (which is only used by xplug2.dll internally)
...\base\plugins\xbase.dll
...\base\plugins\plugins.manifest
// - lists xplug2.dll (for sure)
// - *seems* to need to list also xbase.dll
【问题讨论】:
标签: windows dll manifest assemblies loadlibrary