What is an assembly in .NET?
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,
AssemblyLoadContextcontrols isolation (plugins). - Assembly ≠ namespace:
System.Collections.Generictypes live across several assemblies; your project's assembly can holdMyApp.DomainandMyApp.Datanamespaces.