【发布时间】:2011-12-29 23:24:33
【问题描述】:
有没有办法设置 MAF 插件,以便在从插件的 AppDomain 内部调用 System.Reflection.Assembly.GetEntryAssembly() 时返回对插件主程序集的引用?
背景:为了满足我的项目的某些安全要求,我必须在单独的 AppDomain 中加载插件,并且从插件的 AppDomain 内部调用时,GetEntryAssembly() 的结果必须设置为插件的(强命名)主程序集。我按照MSDN MAF walkthrough 中列出的模式开发了一个测试用例。在我的测试用例中,如果程序集加载到单独的 AppDomain(或进程)中,GetEntryAssembly() 始终返回 null。
我注意到 GetEntryAssembly 文档说“当从非托管应用程序加载托管程序集时,GetEntryAssembly 方法可以返回 Nothing”——这是否适用于 MAF 跨 AppDomain 边界的代理?
相关的程序集和可执行文件都有强名称。
【问题讨论】:
标签: c# appdomain strongname maf