|
Introduction To Assemblies |
|
|
|
An assembly is self-describing because it includes metadata that describes the assembly. Metadata includes the types exported from the assembly and a manifest. A Manifest is a data structure. The manifest serves the same purpose as the type library and associated registry entries do for a COM component. Manifest contains more information than a type library. Assemblies can be loaded using the side-by-side technique. This means a different version of the same assembly can be used inside a single process. Assemblies support Zero-impact installations. Installations can be as easy as copying the files that belong to an assembly.
As told before the assembly consists of assembly metadata describing the assembly, type metadata describing the exported types and methods, MSIL code, and resources. These parts of an assembly can be inside one file or spread across several files.
The manifest is an important part of an assembly and is part of the metadata. A manifest contains:
There are two types of assemblies available: private assemblies and shared assemblies. A private assembly is used by only one application while a shared assembly is shared among different applications. By default when we compile a C# program, the assembly produced will be a private assembly. The file should be placed in the same folder where the calling application is stored. With a private assembly it’s not necessary to think about naming conflicts with other classes or versioning problems because each application has its own copy of the assembly. In shared assemblies we
must be careful that the assembly must be unique, and therefore, have a
unique name (called a strong name). |