Probing the assembly from parent directory of the exe

人走茶凉 提交于 2019-12-12 13:28:32

问题


i have a folder structure as IntegrationClient\SampleClient\Client.Exe. I have created a folder DrawingClient with lot of thirdparty assemblies. For client.exe to find the assembly at runtime , i have used probing path as below and it works.

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

But if i need the client.exe to find the DrawingClient folder from parent directory ie under IntegrationClient\DrawingClient, can i achieve that by any means ? I tried using ..\DrawingClient however that failed.


回答1:


Sadly, you cannot...

The MSDN Documentation states that privatePath [...] [s]pecifies subdirectories of the application's base directory that might contain assemblies. [...]




回答2:


Firstly I'm pretty sure you have to use forward slashes rather than backslashes.

In addition to that you can chain your ../ lookups as far back up the directory tree you need to go

Example:

this ../ is the Parent Directory and this ../../ is the Grand-Parent directory and so forth...



来源:https://stackoverflow.com/questions/31556078/probing-the-assembly-from-parent-directory-of-the-exe

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