Chapter 17. Assemblies
An assembly is the basic unit of deployment in .NET and is also the container for all types. An assembly contains compiled types with their IL code, runtime resources, and information to assist with versioning, security, and referencing other assemblies. An assembly also defines a boundary for type resolution and security permissioning. In general, an assembly comprises a single Windows Portable Executable (PE) file—with an .exe extension in the case of an application, or a .dll extension in the case of a reusable library.
Most of the types in this chapter come from the following namespaces:
System.Reflection System.Resources System.Globalization
What’s in an Assembly?
An assembly contains four kinds of things:
- An assembly manifest
Provides information to the .NET runtime, such as the assembly’s name, version, requested permissions, and other assemblies that it references
- An application manifest
Provides information to the operating system, such as how the assembly should be deployed and whether administrative elevation is required
- Compiled types
The compiled IL code and metadata of the types defined within the assembly
Other data embedded within the assembly, such as images and localizable text
Of these, only the assembly manifest is mandatory, although an assembly nearly always contains compiled types.
Assemblies are structured similarly whether they’re executables or libraries. The main difference with an executable is that it defines an entry point.