By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Question on Reflection

P: n/a
I have a question on Reflections.

Basically, I have two visual studio solutions: SolA & SolB.

SolA has a console application project and a class library project. SolB has
some framework class libary projects. The console application proj in SolA
has references to many of the framework class library projects in SolB.

There is one particular project in SolB that has some code to load the
assembly of the class libabry project in SolA. I am using the following call
for loading the assembly.
Assembly asm = Assembly.Load("SolA.ClassLibProj");

I basically need to create an instance of a class present in the SolA
classLibProj using reflections. But, for some reason the line fails stating
an error that the file not found.

To summarize, the execution starts in SolA.ColsoleProj; Then a call happens
to SolB's framework project that inturn tries to load the SolA.ClassLibProj
through assembly.

Please let me know where I am going wrong.

Thanks,
Srikumar

Nov 20 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Srikumar,

The fact that the projects are in different solutions doesn't really
mean much. A solution is a logical construct, it doesn't correspond to any
physical output.

Why not just have a reference from the class library project in solution
B to the library in solution A? It sounds like you really have one set of
libraries which are being used by two executables (which is fine). Why not
have the executables exist in the same directory with the libraries, or
install the libraries in the GAC?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Srikumar Natarajan" <sr****************@community.nospamwrote in message
news:8A**********************************@microsof t.com...
>I have a question on Reflections.

Basically, I have two visual studio solutions: SolA & SolB.

SolA has a console application project and a class library project. SolB
has some framework class libary projects. The console application proj in
SolA has references to many of the framework class library projects in
SolB.

There is one particular project in SolB that has some code to load the
assembly of the class libabry project in SolA. I am using the following
call for loading the assembly.
Assembly asm = Assembly.Load("SolA.ClassLibProj");

I basically need to create an instance of a class present in the SolA
classLibProj using reflections. But, for some reason the line fails
stating an error that the file not found.

To summarize, the execution starts in SolA.ColsoleProj; Then a call
happens to SolB's framework project that inturn tries to load the
SolA.ClassLibProj through assembly.

Please let me know where I am going wrong.

Thanks,
Srikumar

Nov 20 '08 #2

P: n/a
Thanks for your help. I used Assembly.LoadFile instead and pointed the
location of the dll. It now works. Thanks again

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP05.phx.gbl...
Srikumar,

The fact that the projects are in different solutions doesn't really
mean much. A solution is a logical construct, it doesn't correspond to
any physical output.

Why not just have a reference from the class library project in
solution B to the library in solution A? It sounds like you really have
one set of libraries which are being used by two executables (which is
fine). Why not have the executables exist in the same directory with the
libraries, or install the libraries in the GAC?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Srikumar Natarajan" <sr****************@community.nospamwrote in
message news:8A**********************************@microsof t.com...
>>I have a question on Reflections.

Basically, I have two visual studio solutions: SolA & SolB.

SolA has a console application project and a class library project. SolB
has some framework class libary projects. The console application proj in
SolA has references to many of the framework class library projects in
SolB.

There is one particular project in SolB that has some code to load the
assembly of the class libabry project in SolA. I am using the following
call for loading the assembly.
Assembly asm = Assembly.Load("SolA.ClassLibProj");

I basically need to create an instance of a class present in the SolA
classLibProj using reflections. But, for some reason the line fails
stating an error that the file not found.

To summarize, the execution starts in SolA.ColsoleProj; Then a call
happens to SolB's framework project that inturn tries to load the
SolA.ClassLibProj through assembly.

Please let me know where I am going wrong.

Thanks,
Srikumar

Nov 20 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.