问题
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