Assemblies are primary building blocks of Microsoft .NET framework. Every application in .NET Framework is assembly . Assemblies are single block of code that contains all the information about the implementation of classes, structures and interfaces. Every assembly contains metadata called Manifest. It includes the name and version number of the assembly , security information, information about the dependencies, and a list of the resources that constitute the assembly . Hence an assembly is partially compiled .NET code.
An assembly is self descriptive and consists of:
* Manifest: It contains metadata information such as name, version, culture, resources, referenced assemblies and security requirements. In single file assembly the manifest is incorporated into the PE but with multi file assembly a standalone manifest file can exist or the manifest incorporated into one of the PE files in the assembly .
* MSIL: It is Microsoft Intermediate Language Code. It gets generated when you compile an application by using the .NET compiler.
* Required Resources: These include the resource files for the application.
Assemblies are of two types:
1. Private Assemblies
2. Shared Assemblies
A private assembly is used by only one application while a shared assembly is shared amongst different applications. By default an assembly is private. Private assemblies are always placed in same folder in which application resides. Private assemblies are intended to be used for single application. And this frees the developer from naming and versioning issues.
But the shared assemblies available on a system are stored in the Global Assembly Cache. It is the central storage of shared assemblies .
This store is located in the :WindowsAssembly folder. Private assemblies are used by one application only; they do not have versioning or identity issues. But due to common location the shared assemblies must be unique, combination of a file name, a public key, a version number and culture (locale details) gives an assembly a strong name, which is guaranteed to be unique.
Assembly Benefits – Many deployment problems have been solved by the use of assemblies in the .NET Framework.
Microsoft introduced the concept of Assemblies simplifying the application design and deployment. These are self-describing components that have no dependencies on registry entries, assemblies enable zero-impact application installation.
Assemblies have ability to store and execute multiple versions of an application or component on the same computer. You can have multiple versions of the runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Side-by-side execution gives you more control over what versions of a component an application binds to, and more control over what version of the runtime an application uses.
All managed code in the common language runtime receives the benefits of code access security. Basically, Code access security allows code to be trusted to varying degrees depending on where the code originates and on other aspects of the code’s identity. This allows the trusted code to execute. Using code access security, you can specify the set of operations your code should be allowed to perform as well as the operations your code should never be allowed to perform.