Chapter 15. Assemblies and Versioning

In .NET, the basic unit deployable is called an assembly. Assemblies play an important part of the development process where understanding how they work is useful in helping you develop scalable, efficient .NET applications. This chapter explores:

  • The components that make up a .NET assembly

  • The difference between single-file and multi-file assemblies

  • The relationships between namespaces and assemblies

  • The role played by the Global Assembly Cache (GAC)

  • How to develop a shared assembly, which can be shared by other applications

Assemblies

In .NET, an assembly takes the physical form of an EXE (known as a process assembly) or DLL (known as a library assembly) file, organized in the Portable Executable (PE) format. The PE format is a file format used by the Windows operating system for storing executables, object code, and DLLs. An assembly contains code in IL (Intermediate Language; compiled from a .NET language), which is then compiled into machine language at runtime by the Common Language Runtime (CLR) just-in-time compiler.

Structure of an Assembly

An assembly consists of the following four parts (see Figure 15-1).

Part

Description

Assembly metadata

Describes the assembly and its content

Type metadata

Defines all the types and methods exported from the assembly

IL code

Contains the MSIL code compiled by the compiler

Resources

Contains icons, images, text strings, as well as other resources used by your application

Figure 15.1. Figure 15-1

Physically, all four parts ...

Get C# 2008 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.