Difference between Assembly and Module?

S

Sky Sigal

Uh...a bit ashamed to admit this now that I have been programming in C# for
a while...but I still don't clearly understand from the documentation what
the difference between an Assembly and a Module, and when I would use
anything else than Assembly for reflection purposes...

Assembly is the actual dll, or exe file, right?

Module is...? A subset of an assembly? a superset? Nothing to do with it at
all?

And btw: if an application has one exe, and 2 dll -- what is the term for
this totality if any -- or just 'application'?


Sorry for being obtuse on this one ...
Sky
 
J

Jon Skeet [C# MVP]

Sky Sigal said:
Uh...a bit ashamed to admit this now that I have been programming in C# for
a while...but I still don't clearly understand from the documentation what
the difference between an Assembly and a Module, and when I would use
anything else than Assembly for reflection purposes...

Assembly is the actual dll, or exe file, right?

Module is...? A subset of an assembly? a superset? Nothing to do with it at
all?

An assembly is formed from potentially many modules. The manifest of
the assembly list what the modules are. The assemblies built by VS.NET
2003 are (IIRC) all single-module assemblies.
And btw: if an application has one exe, and 2 dll -- what is the term for
this totality if any -- or just 'application'?

Just application, yes.
 
B

Bob Powell [MVP]

A module is the code generated from a single file. A single file can contain
one or more classes so a module may have one or more classes.

Classes, or modules, are distributed in Assemblies along with other embedded
informatiuon such as resources in the form of strings and images. The types
or modules themselves hold no version information. That's all maintained in
the assembly.

The default method for creating an executable file, either EXE or DLL from
Visual Studio is to compile all the files and make an assembly containing
the modules defined in the project. You can however create assemblies
manually using the Assembly Linker program AL.EXE. This enables you to
create single assemblies from several other assemblies. AL can do this
because it can extract the modules from one or more assemblies and create a
new assembly containing them.

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
S

Sky Sigal

Thanks Jon (wow! that was fast response :))
Ok. I think what you telling me is: for the moment (till 2005?), since the
compiler spits out SingleModule Assemblies only, there is no need to
investigate Reflection via Modules -- the results will be identical as what
can be enumerated via use of Assembly.

This may change in the future.

Thanks,
Sky
 
J

Jon Skeet [C# MVP]

Sky Sigal said:
Thanks Jon (wow! that was fast response :))
Ok. I think what you telling me is: for the moment (till 2005?), since the
compiler spits out SingleModule Assemblies only, there is no need to
investigate Reflection via Modules -- the results will be identical as what
can be enumerated via use of Assembly.

Yup, I believe so. (You can create multi-module assemblies by hand, of
course.)
This may change in the future.

I suspect there'll still be little reason to use reflection on
individual modules - normally it'll be fine to operate on the whole
assembly. I don't even know whether VS.NET 2005 will actually create
multi-module assemblies. The usual reason for it from the command line
is to use multiple languages for the same assembly.
 
S

Sky Sigal

Now THAT finally makes sense to me :)

Ok. So Module = original filename.
A Module can have one or more classdefs in it.
An Assembly can have one or more Modules in it.

Wow. Finally! Thank you.
Sky
 
C

clintonG

That was a clear and articulate answer. Thank you for graduating
reading comprhension class. :)

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top