lenmom

博客园 首页 新随笔 联系 订阅 管理

运行时通过探测的方法来查找没有基本代码的程序集。 有关探测的更多信息,请参见运行时如何定位程序集

可以在应用程序配置文件中使用 <probing> 元素,来指定在查找程序集时运行时应搜索的子目录。 下面的示例说明如何指定运行时应搜索的目录。

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

privatePath 特性包含运行时应在其中搜索程序集的目录。 如果应用程序位于 C:\Program Files\MyApp,那么运行时将在 C:\Program Files\MyApp\Bin、C:\Program Files\MyApp\Bin2\Subbin 和 C:\Program Files\MyApp\Bin3 中查找未指定基本代码的程序集。 privatePath 中指定的目录必须是应用程序基目录的子目录。

posted on 2014-04-10 16:45  老董  阅读(218)  评论(0编辑  收藏  举报