Update:
Maybe a better question is: when using reflection, how to invoke DLL in DLL's home folder?
I am using reflection to load some Dlls and run them, which works great. But an issue pops up when my DLL need access external file.
Suppose I have a folder hierarchy like this:
myDLL/
myDll.dll
settings/a.txt
settings/b.txt
app.config
"myDll.dll" will use information from "a.txt", "b.txt" and "app.config".
My reflection program is in a separate folder. It will load "myDll.dll" and run some method in it:
Assembly.LoadFrom(@"path\to\mydll.dll");
But I got an error. This error is related to accessing "a.txt", "b.txt" and "app.config". The reason is these files are not in my reflection program folder,so when my reflection program loads "mydll.dll", "mydll.dll" will try to find "a.txt", "b.txt" and "app.config" under my current reflection program folder.
Is there a way to overcome this?
Thanks
Derek
Aucun commentaire:
Enregistrer un commentaire