Recently, when using. Net to develop plug-in applications, the plug-in file (. dll) dynamically loaded during runtime is not in the framework master.Program(.Exe) directory, so the "cocould not load file or assembly '*****'" exception occurred during running.
This reminds me of the previous method to solve similar errors in Java programs: adding the corresponding directory to the class path or path directory can solve this problem, which is caused by the failure of the Java Virtual Machine to find the path, adding a search path to the corresponding location can solve this problem.
I found a piece of information and found that this problem can be solved as follows in. Net: Before loading the Assembly, add the followingCode
Appdomain. Currentdomain. appendprivatepath (PATH );// Directory of the Assembly
Supplement:Msdn recommends discarding appendprivatepath (...) Instead, you can set the privatebinpath attribute of the setupinformation attribute (appdomainsetup type) of appdomain. However, I cannot set this attribute successfully.L