Om Talsania's Geekypedia
Articles on .NET Architecture, Design, Development and Performance

Structure of a .NET Assembly

Friday, August 31, 2012 9:35 PM
Assembly is the smallest unit of deployment in .NET Framework.

When you compile your C# code, it will get converted into a managed module. A managed module is a standard EXE or DLL. This managed module will have the IL (Microsoft Intermediate Language) code and the metadata. Apart from this it will also have header information.

The following table describes parts of a managed module.

PE Header
PE32 Header for 32-bit
PE32+ Header for 64-bit

This is a standard Windows PE header which indicates the type of the file, i.e. whether it is an EXE or a DLL.
It also contains the timestamp of the file creation date and time.
It also contains some other fields which might be needed for an unmanaged PE (Portable Executable), but not important for a managed one. For managed PE, the next header i.e. CLR header is more important
CLR Header
Contains the version of the CLR required, some flags, token of the entry point method (Main), size and location of the metadata, resources, strong name, etc.
Metadata There can be many metadata tables. They can be categorized into 2 major categories.
1. Tables that describe the types and members defined in your code
2. Tables that describe the types and members referenced by your code
Apart from that, there is another category of tables called Manifest tables, which can be found in the keeper PE file (An assemble could consist of more than one PE files)
IL Code
MSIL representation of the C# code. At runtime, the CLR converts it into native instructions



# re: Structure of a .NET Assembly

it was very helpful 5/2/2017 8:06 PM | kapish

Post a comment