473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Question on Reflection

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
2 2254
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tony Tullemans | last post by:
I am trying to write a subroutine that will examine all the properties of a form to determine which of those are SqlCommand objects, and then set the Connection property of those SqlCommands to a...
1
by: Mike Malter | last post by:
I am just starting to work with reflection and I want to create a log that saves relevant information if a method call fails so I can call that method again later using reflection. I am...
2
by: Dan | last post by:
Let's say I have a class like: class Dummy { public const string CONE = "one"; public const string CTWO = "two"; ... other stuff .... }
7
by: John | last post by:
I have a class the reads in a file and sets the values of the file into its properties. This class is used to populate the data onto a form. This form has controls created at runtime based on...
4
by: Bob | last post by:
If you rename a type at design time, the the task list shows what code broke, which happens to be a very nice list of dependant classes and methods. Is there any way to produce such dependency...
4
by: Doug Handler | last post by:
Hi, I've developed a plug-in application that basically is constructed of 2 pieces 1). the "main framework" 2). channels. Using Reflection in the Main Framework, i dynamically load Channels. ...
4
by: Andre Nogueira | last post by:
Hi guys I am developing a plugin-enabled application, and for that I am using reflection. I created an abstract ("MustInherit") class, from which all plugins must inherit. My question is......
3
by: John Wright | last post by:
How can I set the property of a loaded Assembly using reflection. My Shell program will log in a person and retrieve a list of all programs the person can use. When the shell program launches a...
1
by: Tony Johansson | last post by:
Hello! This is a question about Reflection. I have a small program below where the class are called Mymemberinfo. This class Mymemberinfo is used in GetMembers to get all the member for this...
5
by: =?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?= | last post by:
Hi, is it faster to access the fields from an object directly by using reflection than accessing them by their properties using reflection? Thanks Christian
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.