Structure of a .NET Assembly

Posted by Om Talsania on Geeks with Blogs See other posts from Geeks with Blogs or by Om Talsania
Published on Fri, 31 Aug 2012 15:35:25 GMT Indexed on 2012/08/31 21:38 UTC
Read the original article Hit count: 209

Filed under:
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.

Part
Description
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.
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 code
2. Tables that describe the types and members referenced by your code
IL Code
MSIL representation of the C# code. At runtime, the CLR converts it into native instructions


© Geeks with Blogs or respective owner