EXPLORING MORE INTO .NET ASSEMBLY

Sankha Sumadhura
2 min readDec 14, 2020

In this post lets look into more about .net assembly and look how they actually generated. If you need to understand about how .net execution works read previous post.

From the previous post we saw that by compiling any .net application it will generate assembly(.dll/.exe) which is Intermediate Language(IL) formatted.

Whether an assembly is a .dll or .exe it contains two parts.

  • Manifest
  • IL

What usually happens when compiling a .net application is it will generate IL according to the instructions you programmed and also it generate Manifest which has meta data(version no,app name ,dependencies & etc.) about your application and those two will package in to an assembly.

Lets take a look into an example-

Simple Console Application

The above code snippet is of a simple console application it prints “Hello World” on console.

When we compile this app it will generate an assembly of type .exe as this is a console application.If we compile a class library it will generate an assembly of type .dll .

We can found that assembly inside bin folder of the application.

Assembly inside bin folder

Lets see what is inside DempProject.exe assembly

Structure of an assembly

Structure of an assembly

As I mentioned in the beginning an assembly contains two parts.We can see it by looking into the above picture.The manifestation contains metadata about the application and the directory named with application name , here ‘DempProject’ contains the converted IL formatted code for our c# code converted by the .net compiler.

IL formatted code of Main method

Here we can see the IL formatted instructions for our c# code.Which is not still native code/machine code .Therefore a particular OS can’t run the assembly directly without the help of CLR(Common Language Runtime).

The name of the assembly and the version of the assembly is very important to solve DLL HELL problem.

--

--