Chapter 4: Assemblies, Loading, and Deployment


Windows itself is basically a set of dynamic-link libraries.
Charles Petzold, Programming Windows

Overview

Throughout the history of programming languages and environments, the great has often been separated from the good by the quality of module system used. Managed code has a very rich module system, from which an obvious conclusion can be drawn. When you develop code on the .NET Framework, it is compiled into a format and a unit of execution called an assembly. An assembly can take on the form of an EXE, for standalone, executable programs; or DLL, for libraries on which other programs and libraries may depend. As noted in previous chapters, the CLR integrates with Windows at a number of levels. One such level is the binary format for its programs and libraries. Regardless of whether you create an EXE or DLL, an assembly always follows the Portable Executable/Common Object File Format (PE/COFF, or just PE for short) file format, the common format for binary code on Windows.

The purpose of having a consistent binary format is to facilitate distribution and reuse across other Windows machines. PE files are common to and recognized on all 32-bit Windows platforms. An assembly can be used to package up your program's reusable types and functions, for example, which can then be shared across an entire organization or sold to other Windows users for money. Your language compiler is responsible for generating an assembly, and usually offers various input switches to control the way in which it does so. For example, the csc.exe C# compiler supplies a range of input options to control the output format. Furthermore, a set of tools (e.g., al.exe) and types in the framework (e.g., System.Reflection.AssemblyVersionAttribute) permit you to add or alter information in the binary image, too.

Assemblies contain many types of interesting data, such as a strong name to uniquely identify an assembly and enable precise version-based binding, a culture, and a rich set of metadata structures populated based on the code being compiled, for example. This chapter discusses the basics of assemblies, how the runtime loads, resolves, and binds to assemblies and their references, and deployment. We briefly discuss deployment, including how to share assemblies across a machine using the Global Assembly Cache (GAC), a centralized store for system-wide shared assemblies. ClickOnce, a new 2.0 technology that enables secure and simple policy-based deployment and updating, is not detailed in this chapter. Please refer to Further Reading for more information on ClickOnce.




Professional. NET Framework 2.0
Professional .NET Framework 2.0 (Programmer to Programmer)
ISBN: 0764571354
EAN: 2147483647
Year: N/A
Pages: 116
Authors: Joe Duffy

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net