Hello,
I've a problem with loading classes with the Reflection API of .NET2.0.
What I want to do is the following:
I have a directory which has several subdirectories with DLLs and an EXE File.
The EXE File contains a Class which I want to load and create an instance of.
These projects are auto-generated.
All of them have the same namespace and Classname (i.e.: ns: Converter cn:
Conv).
As I work with Threads, I will happen, that two or more of the Classes (with
same name and namespace) will be loaded parallel. It can of course happen,
that the same class will be loaded at the same time.
My problem is the following:
I load the Class "Converter.Conv" from the file
"C:\Converters\Conv1\conv.exe".
I create an object and call a method of it.
But when the next Converter should be loaded from
"C:\Converters\Conv2\conv.exe" the old one gets loaded (the one from
"Conv1\conv.exe").
I use the Assembly.LoadFrom(path); Method. The path is different, but the
resulting Assembly object contains the old reference.
I don't know why this problem occures, as the path is a different one. I
tried to give the class, which I want to load, another name. So the
"Converter.Conv" class is named "Converter.Conv1", "Converter.Conv2",... but
the same problem occurs.
I hope someone understands my problem and can help me to solve it.
greetings
Florian