Language: EN


What are assemblies in C#

An assembly is the fundamental unit of code that the .NET Framework uses for managing, distributing, and versioning applications.

Assemblies are the basic building blocks for constructing applications in .NET. If .NET were to build a building, assemblies would be the bricks used to build the walls.

Assemblies allow for encapsulating specific functionalities that can be reused in different projects. Additionally, they can be distributed as independent files, simplifying the sharing of components or applications.

Finally, the manifest of assemblies allows for managing different versions of the same assembly. This is crucial for the proper functioning of .NET applications.

Creation and Types of Assemblies

To create an assembly, the source code must be compiled. This process transforms the C# source code into a binary file, which can be:

  • Executable Assemblies (EXE): These contain an entry point, such as the Main method, and can be executed directly by the operating system.
  • Library Assemblies (DLL - Dynamic Link Library): These assemblies contain code that can be reused by other applications. They cannot be executed on their own.

The final assembly file includes compiled code, metadata, and additional resources such as images or configuration files.

Structure of an Assembly

An assembly in C# is composed of several key elements:

IL Code (Intermediate Language)

The C# source code is compiled into an intermediate language called IL, which is executed by the Common Language Runtime (CLR). This IL is platform-independent, allowing the same assembly to be executed in different .NET environments.


It contains information about the assembly itself, such as its version, dependencies, and security permissions. It acts as the “table of contents” of the assembly.

  • Assembly name.
  • Version.
  • Culture.
  • List of files composing the assembly.
  • Dependencies on other assemblies.
  • Security permissions.


The metadata contains detailed descriptions of the types, methods, properties, and events defined in the assembly. They facilitate reflection and interoperability between languages, allowing other assemblies or applications to understand and effectively use the code.


Assemblies can include resources such as images, sound files, localized strings, and other files necessary for the application. These resources are embedded directly in the assembly, simplifying their distribution and use.