I am working on an app that will load plug-ins. The plug-in assemblies reside in a directory that is below my app's main directory.
Looks like this:
MyAppFolder ----------->ThePluginFolder ----------------Assembly1 ----------------Dependency1
My problem occurs with Dependency1 (this is an assembly that Assembly 1 references). The CLR fails to find it.
I have done some reading on Fusion, and it looks as though I could correct this by setting a Private Path with currentAppDomain.AppendPrivatePath.
However, in the .NET 4.0 help, they say that this method is obsolete. They point me to the AppDomainSetup, but I can't use that to modify my current app domain.
Does anyone know what else I can do to get these dependencies to load?
Options I've considered:
I could manually loop through Assembly1's references, and if I find an assembly in the plug-in folder, I could manually load it. (seems like my best option, but I want to make sure I'm not missing anything)
I could hook the AssemblyResolve event of my current domain (but this even looks weird -- you return a value. Does that imply that it's not multicast? I'm handling one aspect of plug-in (a business rule), what if another part of my app wanted plug-in reports? Would I need 1 global event handler?