MEF如何解决不在应用程序根目录下的程序集的依赖关系? [英] How can MEF resolve dependencies of assemblies that don't live at the root of the application?

查看:73
本文介绍了MEF如何解决不在应用程序根目录下的程序集的依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的应用程序编写为由Win32 MFC应用程序启动的类库.我的每个视图都是一个单独的程序集,位于基类库中,该基类库位于托管MFC应用程序的子目录中.

I have written my application to be a class library that is launched by a win32 MFC application. Each of my views is a separate assembly that is located with the base class library that is located in a sub-directory of the hosted MFC application.

我的问题是,如何使用此子目录(而不是根目录)中的程序集使MEF解析导出的类的依赖关系?

My question is, how can I get MEF to resolve the dependencies of my exported classes using the assemblies from this sub-directory instead of the root directory?

这就是我想要的:

ParentFolder
 myapp.exe
 SubFolder
     myMvvmWindow.dll
     myMvvmSubWindow.dll
     *Microsoft.Expression.Interactions.dll*

这就是我现在必须拥有的:

  ParentFolder
     myapp.exe
     *Microsoft.Expression.Interactions.dll*
     SubFolder
         myMvvmWindow.dll
         myMvvmSubWindow.dll

推荐答案

您也可以在app.config文件中执行此操作:

You can also do this in your app.config file:

是否可以设置程序集探测没有app.config的路径?

这通常是我的处理方式.

This is generally how I handle it.

这篇关于MEF如何解决不在应用程序根目录下的程序集的依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆