I'm dynamically loading .dlls, and I'd want to load them from a subdirectory of where my .exe is located.
To get something like Assembly.Load("SomeAssembly");
where SomeAssembly.dll is located under "DLLs\" ,I've done
AppDomain.CurrentDomain.AppendPrivatePath("DLLs");
This works fine, but apparently AppendPrivatePath
is deprecated.
I'm told what replaces it is to place this in my app.config
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="DLLs"/>
</assemblyBinding>
</runtime>
However, this has no effect. Assembly.Load("SomeAssembly")
throws an exception that SomeAssembly
could not be found. So how do I get this working ?
I could ofcourse:
- Continue to use
AppDomain.CurrentDomain.AppendPrivatePath("DLLs");
, even though it's deprecated. - Place all my plugin .dlls in the same directory as the .exe (meh...)