What is an assembly in .NET?

.NET Framework & CLR Runtime Basic Fresher1–2 Yrs Conceptual 1 min read

Quick Answer

An assembly is the unit of deployment, versioning and security in .NET — a compiled .dll or .exe containing IL, a manifest (identity, version, referenced assemblies), type metadata, and optionally resources. A namespace is just a logical name grouping for types; one assembly can span many namespaces and one namespace can span many assemblies.

An assembly is a compiled .NET unit — a DLL or EXE — and it's the thing that gets versioned, deployed and secured as a whole. Inside it there's the IL, a manifest describing its identity and its dependencies, and metadata for every type, which is what reflection uses. A namespace is a completely different thing — it's just a naming scheme for organising types. One assembly can contain many namespaces, and a namespace like System.Collections.Generic is actually spread across several assemblies.

  • Manifest — assembly name, version (1.2.3.4), culture, public key token, and the list of other assemblies it depends on.
  • Metadata — every type, member and attribute, which is what reflection reads.
  • Strong name — a signature with a public/private key pair giving a globally unique identity; required for the old GAC.
  • Loading — the runtime resolves and loads assemblies on demand; in modern .NET, AssemblyLoadContext controls isolation (plugins).
  • Assembly ≠ namespace: System.Collections.Generic types live across several assemblies; your project's assembly can hold MyApp.Domain and MyApp.Data namespaces.