C# Programming :: DLL Hell Problem

What is the DLL Hell problem? 
 
In this tutorial we discuss about DLL Hell Problem.


1. I have 2 applications, A1 and A2 installed on my computer.
2. Both of these application use shared assembly Shared.dll.
3. Now i have a latest version of application- A2 available on the internet.
4.Now i download the latest version of A2 and installed on my machine.
5.this new installation has over written shared.dll, Which is also used by Application - A1.
6. Application - A2 works fine, but A1 fails to work, because the newly installed Shared.dll is not back word compatible.

So, DLL HELL is a problem where one application will install a new version of shared component that is not back word compatible with the version already on the machine, causing all the other existing applications that rely on the shared component to break. With .NET strong named assemblies we don't have DLL HELL problem.

Step1: Create console application A1.
Step2: Create another console application A2.
Step3: Add a ClassLibrary project in this Solution. As below:


Step4: Create  Static method GetMessage in Sample Class in ClassLibrary as below:


Step5: Add this ClassLibrary reference to both these application.
Step6:Now in application A1:
    We import namespace of ClassLibrary assembly.
    Then in main method we doing as below:



Step7: Repeat the Step6 in A2 application:


Step8:Now goto bin folder of A1 and A2 application and copy the A1.exe,A2.exe and ClassLibrary.dll to separate folder.
Step8: Then run A1.exe and A2.exe, This is output the message on console like as below:

 
Step9: Now add changes the name of GetMessage1() to GetMessage2() Method of ClassLibrary and Build the ClassLibrary project.
Step10: Add the reference of this updated Classlibrary.dll to A2 application and update the changes in method name and build this A2 application.
Step11: Now again copy and repalce the A2.exe and ClassLibrary.dll in same folder.
Step12: Now run A1.exe and A2.exe. Here you find no error with A2.exe and with A1.exe this is showing error message on console as below:


Step13: This is actually DLL Hell problem.



In next session we discussing about "How to solve DLL Hell Problem?".