在app.config中使用<codebase>元素

the*_*man 5 .net codebase probing

我打算在我的.NET 3.5 Windows应用程序的bin文件夹以外的文件夹中保留几个dll.我不确定如何使用codebase元素或探测元素来指定正确的路径.这就是我现在在app.config文件中所拥有的,

<runtime>
 <assemblyBinding>
  <dependentAssembly>
    <assemblyIdentity name="CommonLib" publicKeyToken="f0b5026b59d5645e"   
     culture="neutral" />
    <codeBase version="1.0.0.0" href="SharedFolder\CommonLib.dll" />
  </dependentAssembly>
 </assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)

我明白了,无法在运行时加载程序集错误.看来我在配置文件中做错了.SharedFolder是添加到项目的文件夹.

Yur*_*ich 8

似乎codeBase元素用于获取带有URL的文件,您是否尝试过使用探测元素

<runtime>
 <assemblyBinding>
  <dependentAssembly>
    <assemblyIdentity name="CommonLib" publicKeyToken="f0b5026b59d5645e"   
     culture="neutral" />
  </dependentAssembly>
  <probing privatePath="SharedFolder"/>
 </assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)