F.1 What is an assembly?


'Assembly' is a new term coined in .NET to represent a collection of software modules or components . An assembly is a file with a .dll or .exe file extension. A DLL assembly contains library classes and is not executable (much like a Java class without a main method), while an EXE assembly is executable (like a Java class with a main method).

You may have heard of the word 'module'. An assembly can consist of one or more modules. A module is an MSIL file that does not have an assembly manifest. Multiple modules can then be merged into a single assembly. A module file ends with the .netmodule extension.

You use your .NET compilers (such as your C# compiler) to generate assembly and module files from your .NET language source codes.

Despite the .exe extension, executable assemblies are not the same as ordinary Win32 EXE files. Assemblies contain IL code with associated metadata (the metadata describes the IL codes within). Each assembly has one special metadata file called the manifest, which describes the contents of the assembly as a whole.

If you try to run a .NET assembly under Win32 without the .NET framework installed, you will get a message box popping out informing you of a missing DLL file that is required for the execution of that assembly.

A .NET assembly contains a Win32 PE header “ this enables the Win32 environment to run the first part of it like a normal Win32 executable. What happens is that this header references an important method in a DLL file which is part of the .NET framework. This method then interprets the remaining parts of the assembly (which is IL code) and executes them. Win32 cannot understand IL code, but is at least able to run the PE header to invoke the correct method of the .NET framework.

The assembly's manifest contains the following information about the assembly:

  • Assembly name “ the assembly name is a text string.

  • Version number “ each assembly has a 4-part version number; a typical version number would look like 3.4.1.9 (where 3 is the major version number, 4 is the minor version number, 1 is the revision number, and 9 is the build number).

  • (optional) Shared name (sn) and signed assembly hash.

  • Actual files containing IL codes or other resources.

  • Referenced assemblies “ external assemblies that are referenced from the current assembly.

  • Types.

  • Security permissions.

  • Custom attributes “ custom attributes are stored here for quicker access during reflection.

  • Product information “ company name and other copyright stuff.



From Java to C#. A Developers Guide
From Java to C#: A Developers Guide
ISBN: 0321136225
EAN: 2147483647
Year: 2003
Pages: 221
Authors: Heng Ngee Mok

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net