More about .NET Windows DLL Hell

Although my own recent DLL hell with VS2005 is in design time, I have learned quite a good lesson about dynamically loading assemblies and the dll hell you can introduce in that way.

I have an application that makes heavy use of Reflection.Assembly.LoadFrom where I pass in the path of a DLL to be loaded. The DLLs are randomly added to the application as we create them.

What I learned was from this post of Suzanne Cooke’s about the difference between Load and LoadFrom. Load will load assemblies that are in the GAC (and a few other .NET locales) and is a big help in avoiding dll hell because the GAC does a good job of versioning. LoadFrom will load from a  file that you explicitly tell it to and cares not about versioning. There are a lot more pointers to be aware of here. Check out her post on choosing a binding context (Load and LoadFrom are binding contexts) as well as her related post about switching your code from using LoadFrom to using Load. Suzanne writes the kind of posts that cant’ be read lightly and I can’t really absorb their lessons unless it’s something that I need to know. And I needed to know this today!

Don’t Forget: www.acehaid.org

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.