472,119 Members | 1,634 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Reflection with .NET2.0

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
Nov 25 '05 #1
1 1237
I use the Assembly.LoadFrom(path); Method. The path is different, but the
resulting Assembly object contains the old reference.


The path is irrelevant here since it's not part of the assembly
identity. You need assemblies with different names. Have you tried
compiling them to Conv1.exe and Conv2.exe respectively?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 25 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by D. Shane Fowlkes | last post: by
2 posts views Thread by Patrick Smacchia | last post: by
4 posts views Thread by InnoCreate | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.