Share via

Assemblies and the Global Assembly Cache (C# Programming Guide)

An assembly is a fundamental building block of any .NET Framework application. For example, when you build a simple C# application, Visual Studio creates an assembly in the form of a single portable executable (PE) file, specifically an EXE or DLL.

Assemblies contain metadata that describe their own internal version number and details of all the data and object types they contain. For more information see Assembly Manifest.

Assemblies are only loaded as they are required. If they are not used, they are not loaded. This means that assemblies can be an efficient way to manage resources in larger projects.

Assemblies can contain one or more modules. For example, larger projects may be planned in such a way that several individual developers work on separate modules, all coming together to create a single assembly. For more information about modules, see the topic How to: Build a Multifile Assembly.

Assemblies Overview

Assemblies have the following properties:

  • Assemblies are implemented as .exe or .dll files.

  • You can share an assembly between applications by putting it in the Global Assembly Cache.

  • Assemblies must be strong-named before they can be included in the Global Assembly Cache. For more information, see Strong-Named Assemblies.

  • Assemblies are only loaded into memory if they are required.

  • You can programmatically obtain information about an assembly by using reflection. For more information, see the topic Reflection.

  • If you want to load an assembly only to inspect it, use a method such as ReflectionOnlyLoadFrom.

  • You can use two versions of the same assembly in a single application. For more information, see extern alias.

For more information:

C# Language Specification

For more information, see the following sections in the C# Language Specification:

  • 1.2 Program structure

  • 9.1 Compilation units

See Also


C# Programming Guide

Metadata and the PE File Structure


Application Domains (C# Programming Guide)