What are assemblies? Explain their features .
What are the assemblies? Explain their features and basic structure.
Assembly
An assembly is a logical unit that contain compiled code targeted at the .NET Framework.
Assemblies are the primary building blocks of .NET framework applications. In .NET every application is compiled into an assembly, which refers to a portable executable file. The PE file can be either a dynamic link library or an executable that contains the MSIL code of the compiled application. In addition to the MSIL, .NET assemblies include metadata that that describes all the types that are defined in the assembly, with information about is members- methods, properties, events, and fields.
The metadata of .NET assemblies also provides information about the files that belong to the assembly, version information, and the exact information about assemblies that are used.
Assemblies are self-describing installation unit, consisting of one or more files. One assembly could be a single DLL or EXE that includes metadata, or it can consist of different files-for example, resource files modules, and EXE.
Features of Assembly
The features of an assembly are the following:
- Assemblies are self-describing. All the details about the assembly are stored within the assembly itself.
- Version dependencies are recorded inside assembly manifest.
- Assemblies can be loaded side-by-side.
- Installation can be as easy as copying the files that belong to an assembly.
- Assemblies can be private or shared.
Basic Structure of an Assembly
Assemblies are made up of four sections:
- Assembly Metadata
- Type Metadata
- Microsoft intermediate language (MSIL) code
- Resources
1. Assembly Metadata:-
Assembly metadata describes the complete assembly. The assembly metadata is also known as the assembly manifest. Some of the assembly metadata’ content are:
- The name of the assembly.
- The version number.
- The culture used by the assembly.
- The public key and digital signature. These provide a uniquely identifiable ID of who created the assembly.
- A list of all files that make up the assembly.
- A list of all referenced assemblies.
- Reference information for all exported classes, methods, properties, and so on, found in the assembly.
2. Type Metadata:-
Type metadata describe the types within the assembly. It also contains all the publicly exposed types and resources. Resources are files such as BMP or JPG files or any other file needed by the application.
3. Microsoft Intermediate Language(MSIL) code:-
MSIL is the key to .NET capability to be language neutral. All code, no matter what the programming language, is compiled into the same MSIL. Because all languages ultimately compile to the same MSIL. Because all languages ultimately compile to the same MSIL, it is now possible for encapsulation, inheritance, polymorphism, exception handling, debugging, and so on, to be language neutral. MSIL is also one of the keys to .NET capability to be performed independently. with MSIL, one can have “write once, run anywhere” ability.
4. Resources:-
In .NET resources can be stored in two places: in external. resources file or directly within an assembly. Accessing the resources in either location is extremely easy, as the .NET framework base class for access within the System. Resources namespace. These are:
-
Resource manage: Used to access resources from within an assembly.
-
Resource writer: Used to write resources to an external.resource file.
-
Resource reader: Used to read resources from an external. Resources file.
In addition to these classes, the .NET framework provides the utility resgen.exe, which creates a resource file from a text file containing key/value pairs.


