I am trying to load assemblies dynamically through Reflection. i have folder structure like this:
project
\-- BIN
|-- myApp.exe
|-- SOMEEXTENTION1
| |-- someExtention1.dll
| \-- itsDependency1.dll
|
|-- SOMEEXTENTION2
|-- someExtention2.dll
\-- itsDependency2.dll
I can load someExtention using reflection. Problem occurs when during execution someExtention looks for itsDependency. Dot net looks in BIN folder. It doesn't find it there. Appdomain's AssemblyResolve event is raised...
I am trapping this event. In ResolveEventArgs I get the name of the assembly which needs to be loaded. problem is that i don't get the RequestingAssembly. that property of ResolveEventArgs is always empty. I need the requesting assembly so that I can look directly in its own EXTN folder. without that I have to look in all of the EXTN folders, which in my case can be quite large.
RequestingAssembly has a property Location which according to this msdn article contains the path to the physical file. this article also sites a situation when this property could be Nothing. I dont understand the Load-Context discussed there.
Any help would be appreciable...