如何在 MEF 中设置 PrivateBinPath? [英] How can I set PrivateBinPath in MEF?

查看:14
本文介绍了如何在 MEF 中设置 PrivateBinPath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 MEF 中设置 PrivateBinPath?

这就是我想要做的:.NET 中如何改变引用的加载路径?

解决方案

您可以通过应用程序配置文件执行此操作:assemblyBinding 元素,更准确地说 - 探测:

<预><代码><配置><运行时><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><probing privatePath="bin;bin2subbin;bin3"/></assemblyBinding></运行时></配置>

这将强制运行时在 binbin2bin2subbinbin3 目录中查找程序集,所有这些都是应用程序基目录的子目录.

How can I set PrivateBinPath in MEF?

This is what I'm trying to do : How to change the loading path of references in .NET?

解决方案

You can do this through application config file: assemblyBinding element, more precisely - probing:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <probing privatePath="bin;bin2subbin;bin3"/>
      </assemblyBinding>
   </runtime>
</configuration>

This will force runtime to look for assemblies in bin, bin2, bin2subbin and bin3 directories, all of which are subdirectories of the application's base directory.

这篇关于如何在 MEF 中设置 PrivateBinPath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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