Tuesday, November 09, 2004

Assemblies - Part 1


An assembly is a small logical collection of classes that contains the metadata of an application and components and resources that enable you to create an application. An assembly is one of the main components of the .NET framework and it is developed during the Runtime. An assembly provides the CLR with the metadata, which describes types, members, and references in your code. The runtime uses the metadata to locate and load classes, lay out instances in memory, generate native code, and enforce security.

It contains a manifest for executing a Microsoft Intermediate Language-based code (MSIL) at the CLR. Before the advent of the .NET platform, the business logic was implemented in the COM component. The main problem with COM is that it is tightly coupled with the operating system. When you deploy a COM component on a system, it copies the related .dll or .exe file to a specific location and makes an entry for the file in the registry. In COM, every component is uniquely identified in the registry through a Globally Unique Identifier (GUID).

All COM component operations are based on the data in the registry. You cannot implement COM in other operating systems, such as UNIX/Solaris, because you need a registry to use COM-based components.

DLL-hell Problem

COM-based systems are prone to the classic dll-hell problem. You cannot modify a component after it is deployed without affecting existing clients. COM provides a mechanism to register and access multiple versions of a component in the registry, but the operating system does not provide a mechanism to prevent an earlier version of a .dll from accidentally overwriting a newer version.

The assembly handles the operating system dependency and DLL-hell problems because it is a self-describing unit. You can maintain two versions of the same assembly on the same system.

Need for Assemblies

When Microsoft developed the .NET platform, the operating system dependency and the dll-hell problems were a major focus and it wanted to remove the coupling between the platform and the registry. The metadata of an application resides in the application itself and provides multiple versions of applications on the same system because each version maintains its own metadata.

Assembly Advantages

Assemblies provide the following advantages:- Easy Deployment: Allows you to deploy a .NET component on a client computer with a simple Xcopy command.
- Side-by-side Execution: Allows other applications to use assemblies in addition to the primary application.
- Operating System Independence: Allow you to port assemblies to any operating system that supports a .NET common runtime environment.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home