Using Assemblies


.NET assemblies are units of deployment, such as applications and shared libraries. Unlike normal Windows executables, assemblies contain both metadata and IL code. Assemblies can be reused by other applications by including an external reference (typically passed as a /r switch in a compiler and a reference to the appropriate application namespace). Typically, assemblies are statically generated by compilers. However, assemblies can also be dynamically created using the .NET Framework Reflection class library. Assemblies are represented as .NET platform executables (PEs). In addition to the standard PE headers, Microsoft has extended the PE/COFF (Common Object File Format) to include CLR information, such as the CLR header and CLR data (metadata and IL). If you are interested in understanding a .NET PE, you can use the dumpbin utility available in Visual Studio .NET to dump the content of an executable file into readable text. Assemblies can be created directly by compilers into a single file or can be represented as multiple files, which can be linked by the al (assembly linker) utility.

Assemblies contain a manifest, which is metadata about the assembly. The manifest identifies the assembly, listing the files that belong to that assembly, and also identifies externally referenced assemblies. Assemblies can be private (for a particular application) or shared in the Global Assembly Cache (GAC) (shown in Figure 2.3). .NET assemblies can be identified by the strong name, which is based on public/private keys. With the GAC, strong name assemblies provide side-by-side execution capability for running multiple versions of the same assembly together, without the associated "DLL Hell." Shared assemblies in the GAC are required to have a strong name . Assemblies make the deployment model as simple as plug and play. For private assemblies, you can copy them to the target machine for execution, without worrying about registries and so on. If your application uses shared GAC assemblies, your application's manifest contains information related to the proper identification of the assembly through its strong name.

Figure 2.3. Global Assembly Cache.



Microsoft.Net Kick Start
Microsoft .NET Kick Start
ISBN: 0672325748
EAN: 2147483647
Year: 2003
Pages: 195
Authors: Hitesh Seth

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