If it cannot find the dependent assembly in ordinary places , you need to manually specify how to find them.
The two easiest ways I know for this are:
Essentially, you need to know the dependencies for the assembly that you are trying to load in advance, but I don't think such a big question.
If you go to the first option, it would be useful to see the difference between a full load and a reflection of only the download .
If you prefer to use 2 (which I recommend), you can try something like this, which has the additional advantage of working with nested dependency chains (for example, MyLib.dll links, Storyage.dll local resources links, Raven links. Client.dll NewtonSoft.Json.dll), and will also provide you with information about what dependencies it cannot find:
AppDomain.CurrentDomain.AssemblyResolve += (sender,args) => { // Change this to wherever the additional dependencies are located var dllPath = @"C:\Program Files\Vendor\Product\lib"; var assemblyPath = Path.Combine(dllPath,args.Name.Split(',').First() + ".dll"); if(!File.Exists(assemblyPath)) throw new ReflectionTypeLoadException(new[] {args.GetType()}, new[] {new FileNotFoundException(assemblyPath) }); return Assembly.LoadFrom(assemblyPath); };
source share