What Are the Benefits of Using Assemblies?
Assemblies are mainly introduced to solve the problems of versioning, DLL conflicts, and simplifying the process of deployment.
Most end users have encountered versioning or deployment problems when they do install a new application or a new version of an existing one. There are many situations where you install a new application only to find an existing one stopped working, and the system can not recover from that. Many developers spent a lot of time trying to retain the registry entries consistence in order to activate a COM class. All this frustration occurs because of versioning problems that occur with component-based applications.
Versioning Problems
There are two versioning problems that arise with WIN32 applications. The first one is that versioning rules are enforced by the operating system not between the pieces of an application. Backward compatibility between the new piece of code and the old one is the current approach of versioning and this is hard to maintain in most applications. Beside that only a single version of an application is allowed to be present and executing on a computer at any given time. The second problem is that there is no way to preserve consistency between groups of components that are built together and the current present group at run time.
DLL Conflicts
As a result of the above two versioning problems, DLL conflicts do occur. Which is: when installing a new application an existing one may break because of that the new one installed a new version of a component or a DLL that is not fully backward compatible with the previous one.
The Solution
To solve the above problems, Microsoft began a new approach in its Windows 2000 platform. Windows 2000 gives you the ability to place DLL files used by your application in the same directory as your application's exe file, so that your application can use the right version it was designed for using. Beside that, Windows 2000 locks files that exist in the System32 directory to prevent their replacement when new applications are installed, and this prevents the DLLs that are used by existing applications from being replaced and so prevents the crashing of existing applications.
The .NET framework introduces assemblies as an evolution towards the complete solution of versioning problems and DLL conflicts. Assemblies on their core design give developers the ability to specify version rules between components, offer the infrastructure required to enforce these rules, and allowing multiple versions of the component to be run side by side at the same time.
How Does It Work?
You may recall that an assembly manifest contains the versioning requirements of the current assembly. The version of the assembly and the versions of the required assemblies and/or components are recorded in the manifest. So, when you run an application, the .NET runtime checks the assembly manifest of your application and executes the version of assemblies or components that are recorded in the manifest. To gain the advantages of versioning you must give your assembly a strong name (will be explained later).
No comments:
Post a Comment