How to properly access the PrivateBinPath property of the current AppDomain?

匆匆过客 提交于 2019-12-04 06:57:33

use

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="AlternateLookupPath" />
    </assemblyBinding>
  </runtime>

According to http://msdn.microsoft.com/en-us/library/823z9h8w.aspx the privatePath is already interpreted as "subdirectories of the application's base directory"... so I suspect that using .\ is somehow messing things up...

From the docs:

If the directories specified for PrivateBinPath are not under ApplicationBase, they are ignored.

So, you need to make sure the paths you are add are under ApplicationBase.

This only works with app.config however. If you need to do this at runtime, use the AssemblyResolve event as described in the docs:

http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!