473,385 Members | 1,856 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,385 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 2255
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.