Friday, June 11, 2010

How strong name assemblies keep you out of DLL Hell

while using Microsoft .NET framework for creating any application we are previously facing same problem with the DLL Hell. it arises a problem while updating a components so it breaks the other application which are depend on it. to overcome such a issues developer needs to implement the concept of Strong name .In this article you can through with how and why to use strong name .

Strong Name :
what is strong name? A Strong name is of information used to identify the assembly which may consist of Text-name , four part of version number , culture information , public key and the digital signature which may stored in a assembly manifest that get embedded on the file of the assembly.

By using the Strong name the CLR can assured that two assembly can be there with the same name. by the way strong name is basically provided the unique identification of the assembly. there are two scenarios in which the strong name can included in the assembly
1.Shared Assemblies
2. Serviced Components.

on the first case the shared assemblies can be used in the multiple application which may running on the same machine on GAC. and you may get the benefit ares:
1. Single Development
2. Bypass verification
3. Centralized update

yes as your getting such a good benefits then surely there is also a some issues on it that is
1.calling a private assemblies : if the shared assemblies can load with the type of private assembly then CRL will throw an Error because it reference only shared assemblies.
2. Trusting assemblies :
3. Installation issues :

How to create "Strong Name".
To create strong name for assembly you need a (al.exe) tool which is a assembly generation tool .now to create a key pair in the file you can use Strong name utility (Sn.exe) like this way.
Sn.exe -k filename.dat

The key file could be used on Al.exe to generate the strong name.
Al.exe /out:Input.dll /Keyfile:output.dat

Like this way you can design your strong name with the key. hope you get something from this
if you have any query on it plz post the reply.