Explain how the assemblies and DLLs work in .NET

ASP.NetServer Side ProgrammingProgramming

Assembly contains all the compiled types in your application along with their Intermediate Language (IL) code. It is also the basic unit of deployment in .NET. In the latest versions of .NET, i.e. .NET Core, an assembly is a file with a .dll extension, which stands for Dynamic Link Library.

There are primarily four items in an assembly.

Compiled Types

The compiled IL code for all the types in your application.

Assembly Manifest

Contains the metadata needed by the Common Language Runtime, such as the dependencies and versions that this DLL references.

Its purpose is to describe the assembly to the runtime via the assembly's data, types, and functions. It's added automatically when you compile the source code to build the assembly.

You can use a tool such as ildasm.exe to view the contents of an assembly. Here's some of the data that an assembly manifest contains.

  • Name and version number of the assembly
  • A list of assemblies that this assembly references
  • A list of types defined in the assembly
  • Company and the copyright information
  • Additional custom data

You can either edit the .csproj file or set the properties on the project in Visual Studio to specify the assembly attributes. You can also specify them in the source code itself, using the AssemblyInfo.cs file.

Application Manifest

Contains the metadata for the operating system about deployment and administration. It's added during the build process. The application manifest file is optional. If it is present, it's processed before the runtime loads the assembly.

To add an application manifest to your application, right-click the project in Visual Studio and select Add > New Item > Application Manifest File. When you build the application, it will be embedded into the output assembly.


Contains the resources needed by the application such as images and text.

Updated on 19-May-2021 08:17:06