Assemblies in C#

In this article we will discuss about what are assemblies.
  • 3851

Assemblies are the single deployment unit. It is a self-describing unit which describes itself. It contains metadata which means data about data. It contains MSIL code in it and it is portable executable file which resides on a disc. Assemblies take the form of an executable (.exe) file or dynamic link library (.dll) file, and are the building blocks of the .NET Framework. It contains the type information in it and also the resources that what kind of resources it is going to be used. It does not need to be registered because it is self-deployment unit. It reduces the DLL Hell problem.

In Dll-Hell problem if the programmer will make the program within a namespace then a version number will create for the application. Then if another programmer will make another application with same name within the same namespace then the same version will be created then it will create a problem because the programmers can't differentiate which application was of them. This denotes the DLL Problem.

To solve this problem we can use versioning concept of assembly in .net. Through this we can give the different version number to the applications. The MSIL code store under the assemble which contains the metadata. While running the application the assembly is loaded into Application Domain. The CLR contains the application domain and we can run different-different application at one time in separate application domain which secures one application from another. The Assemble contains the Assembly Metadata, Type Metadata, IL Code and resources. The runtime of the .net uses this metadata to run the application properly and pass it to the application operating System. The assemblies are used for reusability purpose.

assembly.jpg

In this diagram we have the idea that:

  1. We have written the C# application.
  2. Now in the second step C# language compiler converting it into MSIL code which stores in an Assembly with metadata and at the same time it is using the existing assembly of another application.
  3. Now while running it is called by the runtime which further calls the JIT compiler which converts it in the native code by using its metadata.
  4. Now at last this machine code is executed by the computer.

Further Readings
 
You may also want to read these related articles.

Ask Your Question 

Got a programming related question? You may want to post your question here
 

© 2020 DotNetHeaven. All rights reserved.