473,385 Members | 2,243 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.

Setting References - What Happens Behind The Scenes?

The "big picture" here is that I'm wondering what it is *specifically* about
[setting a reference] that enables my application (e.g., Project_A.exe) to
recognize and consume the types located in referenced assemblies.

Suppose I have Project_A (Windows Forms application) opened in Visual Studio
and I set a reference to two other assemblies:

1. Project_B (which is a class library project included in the same solution
as Project_A)

2. Library_C (which is a .NET class library on the local machine, but for
which we do not have the VS project)

What changes happen in the assembly or project metadata for Project_A for
each of the two references described above?

I understand that I can open the .csproj and/or the .sln files and see
additional entries per the references ---but what is different about the
compiled assembly (Project_A.exe) for having the references (vs not having
the references)?

Thanks.
Aug 6 '07 #1
6 1333
Hi,

"Smithers" <A@B.comwrote in message
news:Ob**************@TK2MSFTNGP05.phx.gbl...
The "big picture" here is that I'm wondering what it is *specifically*
about [setting a reference] that enables my application (e.g.,
Project_A.exe) to recognize and consume the types located in referenced
assemblies.

Suppose I have Project_A (Windows Forms application) opened in Visual
Studio and I set a reference to two other assemblies:

1. Project_B (which is a class library project included in the same
solution as Project_A)

2. Library_C (which is a .NET class library on the local machine, but for
which we do not have the VS project)

What changes happen in the assembly or project metadata for Project_A for
each of the two references described above?
Simply it indicate to the compiler to include those assembly at compile
time. Where the references being used is kept is not really important, and
it changes depending of the version/type of project.
IIRC by default it's kept in the project file (.csproj) but for example in
2.0 web sites it's kept in the config file.
I understand that I can open the .csproj and/or the .sln files and see
additional entries per the references ---but what is different about the
compiled assembly (Project_A.exe) for having the references (vs not having
the references)?
There is no difference, remember, the referenced assembly MUST BE compiled
when is being used. What the IDE does is compile the referenced assembly
BEFORE compile the assembly that uses it.
Aug 6 '07 #2
Thanks Ignacio,... now RE:
<< Simply it indicate to the compiler to include those assembly at compile
time.>>

Does this mean that the compiled Project_A.exe file will contain (within the
..exe file), each referenced .dll in its entirety?

Or does the compiled Project_A.exe file simply contain metadata about each
referenced .dll?

-"Smithers"

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.uswrote
in message news:eY*************@TK2MSFTNGP05.phx.gbl...
Hi,

"Smithers" <A@B.comwrote in message
news:Ob**************@TK2MSFTNGP05.phx.gbl...
>The "big picture" here is that I'm wondering what it is *specifically*
about [setting a reference] that enables my application (e.g.,
Project_A.exe) to recognize and consume the types located in referenced
assemblies.

Suppose I have Project_A (Windows Forms application) opened in Visual
Studio and I set a reference to two other assemblies:

1. Project_B (which is a class library project included in the same
solution as Project_A)

2. Library_C (which is a .NET class library on the local machine, but for
which we do not have the VS project)

What changes happen in the assembly or project metadata for Project_A for
each of the two references described above?

Simply it indicate to the compiler to include those assembly at compile
time. Where the references being used is kept is not really important, and
it changes depending of the version/type of project.
IIRC by default it's kept in the project file (.csproj) but for example in
2.0 web sites it's kept in the config file.
>I understand that I can open the .csproj and/or the .sln files and see
additional entries per the references ---but what is different about
the compiled assembly (Project_A.exe) for having the references (vs not
having the references)?

There is no difference, remember, the referenced assembly MUST BE compiled
when is being used. What the IDE does is compile the referenced assembly
BEFORE compile the assembly that uses it.

Aug 6 '07 #3
Smithers,
Download Lutz Roeder's "Reflector" product, load an assembly that you have
built after adding a reference, and examine the metadata section to see it
for yourself.
Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com

"Smithers" wrote:
The "big picture" here is that I'm wondering what it is *specifically* about
[setting a reference] that enables my application (e.g., Project_A.exe) to
recognize and consume the types located in referenced assemblies.

Suppose I have Project_A (Windows Forms application) opened in Visual Studio
and I set a reference to two other assemblies:

1. Project_B (which is a class library project included in the same solution
as Project_A)

2. Library_C (which is a .NET class library on the local machine, but for
which we do not have the VS project)

What changes happen in the assembly or project metadata for Project_A for
each of the two references described above?

I understand that I can open the .csproj and/or the .sln files and see
additional entries per the references ---but what is different about the
compiled assembly (Project_A.exe) for having the references (vs not having
the references)?

Thanks.
Aug 6 '07 #4
Smithers <A@B.comwrote:
Thanks Ignacio,... now RE:
<< Simply it indicate to the compiler to include those assembly at compile
time.>>

Does this mean that the compiled Project_A.exe file will contain (within the
.exe file), each referenced .dll in its entirety?

Or does the compiled Project_A.exe file simply contain metadata about each
referenced .dll?
The exe file contains assembly references, and each use type which is
involved in the exe says which assembly it should come from. The
references are then resolved at execution time.

It definitely *doesn't* contain the whole dll.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 6 '07 #5
Wonderful - thanks!

-"Smithers"
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yohohhoandabottleofrum.comwrote
in message news:F8**********************************@microsof t.com...
Smithers,
Download Lutz Roeder's "Reflector" product, load an assembly that you have
built after adding a reference, and examine the metadata section to see it
for yourself.
Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com

"Smithers" wrote:
>The "big picture" here is that I'm wondering what it is *specifically*
about
[setting a reference] that enables my application (e.g., Project_A.exe)
to
recognize and consume the types located in referenced assemblies.

Suppose I have Project_A (Windows Forms application) opened in Visual
Studio
and I set a reference to two other assemblies:

1. Project_B (which is a class library project included in the same
solution
as Project_A)

2. Library_C (which is a .NET class library on the local machine, but for
which we do not have the VS project)

What changes happen in the assembly or project metadata for Project_A for
each of the two references described above?

I understand that I can open the .csproj and/or the .sln files and see
additional entries per the references ---but what is different about
the
compiled assembly (Project_A.exe) for having the references (vs not
having
the references)?

Thanks.

Aug 6 '07 #6
Hi,

"Smithers" <A@B.comwrote in message
news:O9**************@TK2MSFTNGP02.phx.gbl...
Thanks Ignacio,... now RE:
<< Simply it indicate to the compiler to include those assembly at compile
time.>>

Does this mean that the compiled Project_A.exe file will contain (within
the .exe file), each referenced .dll in its entirety?

Or does the compiled Project_A.exe file simply contain metadata about each
referenced .dll?
just the references, if you go to the debug folder you will see that along
your .EXE you will find the dll you use. If you delete the dll and double
click the exe you will get an error.
Aug 6 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: JKop | last post by:
I understand variables/objects and pointer variables perfectly: int X = 5; int* pX = &X; *pX = 4; int** ppX = &pX:
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
5
by: Robert Zurer | last post by:
I have a large pool of business objects all referencing one another in various ways. In the client application I want to do something like employee.Delete(); Behind the scenes, I want to...
1
by: mplutodh1 | last post by:
This may seem like an odd thing to do, but is there a way to blindly post to a form. By that I mean, sending data (First_Name=John) without actually having the browser go to that page? I am...
0
by: Learning SQL Server | last post by:
I dont think I'm doing something right here or maybe I am misunderstanding the concept. Hope someone can help. I have a solution with 5 projects. Each one builds into its own class library. They...
1
by: Frank Yamrick | last post by:
I am trying to program an application that requires a large number of screnes that are very similar in the respect that all the bottons and labels interact with each other with the same...
13
by: ragged_hippy | last post by:
Hi, I wanted to create a vector of const references. Something like this: vector<const x&y; where x is a class name. Is this a valid statement? Will this work if I use a reference of 'y'...
9
by: igor.kulkin | last post by:
References is a relatively basic feature of C++ language. It might be a good thing to think of references as aliases to the variables. However it's good to think of references this way when you...
2
by: subramanian100in | last post by:
From http://groups.google.com/group/comp.lang.c++/browse_frm/thread/d5da6e5e37fd194d/6e2e8424a1cfbd2b#6e2e8424a1cfbd2b the following portion is taken. "Mike Wahler"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.