473,836 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1346
Hi,

"Smithers" <A@B.comwrote in message
news:Ob******** ******@TK2MSFTN GP05.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.mach in AT dot.state.fl.us wrote
in message news:eY******** *****@TK2MSFTNG P05.phx.gbl...
Hi,

"Smithers" <A@B.comwrote in message
news:Ob******** ******@TK2MSFTN GP05.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.ex e) 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.co m>
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*******@yaho o.yohohhoandabo ttleofrum.comwr ote
in message news:F8******** *************** ***********@mic rosoft.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******** ******@TK2MSFTN GP02.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
2407
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
18454
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 a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
5
9760
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 remove all references to the object allowing it to be garbage collected. I then want to remove the physical representation of the object from persistance. Unless I have missed a scenario, the references to the object can be deleted in two ways
1
1150
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 working on an event registration site, all of the basic registration is done in a simple ASP.NET form which saves the data to an Access DB. We need a mailing list for our website and instead of completely reinventing the wheel I am using an ASP script...
0
982
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 are not dependent on each other in terms of specific build order; but related items in my application that I am aggregating for the sake of organization. However, each library does reference the others in code. Compilation works fine. However,...
1
1995
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 relationship. If possible, it seems it would be easier to set up one standard page where the text is blank for each radiobutton, button, or label. The text would then be filled in by specifying the dataset and databinding information via code under the...
13
10299
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' somewhere else?
9
2477
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 deal with references which are local variables. But references can also be function arguments (in fact they are more useful this way) in which case it has to have the in-memory representation.
2
360
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" <mkwah...@mkwahler.netwrote: " An object will occupy memory space (in your program's memory area). A reference is simply another
0
9668
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10840
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10546
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10588
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.