AppDomain.Load loads the assembly in the current executable AppDomain, and not in "TempDomain". As noted in the MSDN document:
This method should only be used to load the assembly into the current application domain. This method is provided as a convenience to compatible subscribers who cannot invoke the static assembly Assembly.Load method. To load assemblies into other application areas, use a method such as CreateInstanceAndUnwrap.
Now, in your case, the call fails because the currently executing AppDomain (most likely your main AppDomain) cannot find the assemblies from the subdirectory. When you try to load assemblies in the context of the load, you must ensure that these assemblies are located in one of the following places:
- AppDomain base directory
- auxiliary directory of the base dir, which is specified in the personal application pools of AppDomain
- Gac
For more information, you can check out the following articles:
How Runtime Finds Assemblies
Assembly loading guidelines
Back to Basics: Using Fusion Log Viewer to Debug Obscure Loader Errors
source share