How is the DLL HELL problem solved in .NET


All Questions
ASP.NET
CSharp
SQL Server


All Questions
WCF
MVC
HR Round

Search This Site



Please read What is dll hell? interview question, before proceeding with this article.


In short, the dll hell problem is solved in .NET by signing the shared assemblies with strong name. Please follow this article, to understand the process of strong naming an assembly.

In dot net all the shared assemblies are usually in the GAC. GAC stands for Global Assembly Cache. The path for GAC is C:\[OperatingSystemDirectory]\assembly. For example on my computer the path is C:\WINDOWS\assembly. The image below shows the shared assemblies in the GAC.



Only strong named assemblies can be copied into GAC. Strong named assemblies in .NET has 4 pieces in its name as listed below.
1. Simple Textual Name
2. Version Number
3. Culture
4. Public Key Token


All these four pieces put together, is called as the fully qualified name of the assembly. In the GAC image above Accessibility assembly has a version of 2.0.0.0.



Now consider the example below:
1. I have 2 applications, Application - A1 and Application - A2 which relies on the shared assembly Accessibility.dll (Version 2.0.0.0) as shown in the image below.


2. Now, I have a latest version of Application - A2 available on the internet.

3. I download the latest version of A2 and install it on my machine.
4. This new installation copies a newer version of Accessibility.dll into the GAC with version 3.0.0.0.
5. So, in the GAC we now have 2 versions of Accessibility.dll.
6. Application - A1 continues to use Accessibility.dll (version 2.0.0.0) and Application - A2 uses Accessibility.dll (version 3.0.0.0)
7. So, now the assemblies are able to reside side by side in the GAC. For this reason dot net assemblies are also said to be supporting side by side execution.

If you can improve this answer further, please feel free to do so by submitting the form below. Thank you very much for your contribution.


All Questions
ASP.NET
CSharp
SQL Server


All Questions
WCF
MVC
HR Round

Search This Site

15 comments:

  1. veknat,i ma very thankufull to you,you have picturesqued the dll hell problem..it s superb explnation.once agian thanku

    ReplyDelete
  2. hi,
    the explanations on this site are
    very good simple and to the point Bravo!!

    ReplyDelete
  3. Really good one

    ReplyDelete
  4. i dont know .net.. but i got it

    ReplyDelete
  5. IN DLL HELL PROBLEM WHERE IS THE SHARED ASSEMBLY STORED.I STUDIED THAT SHARED ASSEMBLIES ARE IN GAC.

    ReplyDelete
  6. You have made it so simple to understand.
    Thanks a lot.

    ReplyDelete
  7. hi i m gaurav
    u can use very simple language to understand the question.
    and it benifit for me i learn soo much from your site

    ReplyDelete
  8. Nice article for beginners and for the expertise as well

    ReplyDelete
  9. You should have explained the problem first, then you can provide the solution. I don't find any clear explanation of the problem "DLL Hell". Allyou have provided is a solution of an Unexplained question.

    ReplyDelete
  10. Hi Venkat,

    DLL Hell solved in .net framework explanation with pictorial representation is nice which is easily understand by every one..

    ReplyDelete
  11. If latest version of A2 and installed it on my machine.How it will copy the new version of the assembly into the assebly filder witjout running the gacutil.Could u calrifty?

    ReplyDelete
  12. Thanks, its Great.
    It is exactly Ilooking looking for.
    Thank you again.

    ReplyDelete
  13. I have never seen a better explanation..

    ReplyDelete
  14. I spent many hours to get an idea on DLL problem in different websites but in vain. This site has given clear explanation. Thanks a lot

    ReplyDelete
  15. Create a web application using asp.net and ajax technology that accepts a keyword and displays 10 relevant tweets from Twitter in real-time for that keyword.

    ReplyDelete

If you are aware of any other asp.net questions asked in an interview, please post them below. If you find anything missing or wrong, please feel free to correct by submitting the form below.

 
Disclaimer - Terms of use - Contact Us | Internet Marketing