In your case you have two possible scenarios:
1- Your Exe and your Plugin share a reference: In that case the shared referenced is already loaded by the Exe and you don't need to worry about loading it. Even if you try to load it again since it already exists in loaded assemblies it wouldn't get loaded again.
2- Your Exe does not reference the library the plugin references. In this case if the library assembly exists in your subfolder and you use LoadFrom
it should try to load the dependant assemblies for you. Now, although your application startup path is the Exe's directory, I don't think the assembly resolve would fail in case you have a direct reference from your plugin to the library. However if it does fail for whatever reason, the .Net framework has the AssemblyResolve
to assist you. You just subscribe to that event and have it search the right path(the subfolder) for the library.
It's not really cumbersome. It's just subscribing to a single event. Something like this:
private static Assembly ResolveAssembly(object sender, ResolveEventArgs e)
{
//The name would contain versioning and other information. Let's say you want to load by name.
string dllName = e.Name.Split(new[] { ',' })[0] + ".dll";
return Assembly.LoadFrom(Path.Combine([AssemblyDirectory], dllName));
}