I have a folder "DLLs" where all assemblies are kept related to my project. As per current practice, all the exes (of my project) copy the DLLs from this folder to their "own" folder (each exe has its own folder like SupportTools/DbAccess, SupportTools/WebReq ..etc) and when a software is run it picks the DLLs from its "own" folder by default.
I feel this is unnecessary overhead. So I want to eliminate this copy. I referred yo below link and loaded assemblies from custom path (from DLLs)
How to add folder to assembly search path at runtime in .NET?
But not there is another problem arising.
- Say I have
SomeAssembly.dll
I loaded it from DLLs
Assembly.LoadFrom(customPath + "SomeAssembly.dll")
Now this
SomeAssembly.dll
depends onSomeOther.dll
which is needs at the time of below codeassembly.CreateInstance(.."SomeAssembly.dll"..)
It fails at this point, as it (might be) searching in current and
SomeOther.dll
isn't present in current application's "own" folder
(Names hidden for obvious reasons)
How can I make it to look at the custom path at this time ?