By default .NET searchs for dependendent assemblies in directory of executable file in and in GAC. But developer can specify additional directories in exe.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="./Lib" />
</assemblyBinding>
</runtime>
</configuration>
There are some limitations: no absolute paths and no walking up the directory tree ( ..\Lib will not work). Recently I've tested this for satellite assemblies and I have found that frameowork searchs in provided directories for satellite assemblies. So I can make something like that:
Main.exe
Main.exe.config
I18N\en-US\Main.resources.dll
I18N\ru-RU\Main.resources.dll
However as I've mentioned if I move Main.exe to Bin directory this will not work correctly. I know 2 possible ways to override this:
- codeBase element in config file, but it requires absolute path
- Adding handler for ApplicationDomain.AssemblyResolve event which will return whatever you want.