Structure of a .NET Assembly
- by Om Talsania
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.PartDescriptionPE HeaderPE32 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 importantCLR HeaderContains
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.MetadataThere can be many metadata tables. They can be categorized into 2 major categories.1. Tables that describe the types and members defined in your code2. Tables that describe the types and members referenced by your codeIL CodeMSIL representation of the C# code. At runtime, the CLR converts it into native instructions