Short of reorganizing your application structure, you could use the AppDomain.AssemblyResolve event
.
Basically works like this.
- Subscribe to the AssemblyResolve event on the AppDomain.
- When the event fires, you can specifically look for your SharedLib.dll or simply attempt to create a full path to the desired assembly in your root folder given the assembly name specified in the
ResolveEventArgs.Name
and useAssembly.LoadFrom(path)
. - If the assembly successfully loaded from the path, return it in the AssemblyResolve handler, otherwise return
null
.