

which means multiple versions of the same assembly are loaded and act as different modules. This can be problematic. The CLR does supports side-by-side loading. Use a single reference versions or load versions side-by-sideįirst of all, there’s an important decision to make: Do we want to force our projects to use the same reference version? Or do we want to load different versions side by side and use both? If you’re in one of those times, this article is for you. The references might be referenced by a 3rd party that you can’t edit or you might have limitations like. Sometimes tough, you can’t depend on a single reference version due to all kind of reasons. Some resources to help with DLL Hell are:, , This is widely referred as DLL Hell and isn’t in the scope of this article. Sometimes it’s as easy as going to NuGet manager and changing the versions. The best solution is to remove the need for different reference versions. If possible, resolve to a single reference version Luckily, Microsoft put a lot of thought into this issue and there are a lot of things we can do about it. If you ran into this exception, you are in the right place. The located assemly’s manifest definition does not match the assembly reference. The result is the same and our application will fail with: Could not load file or assembly or one of its dependencies. We also reference project B with NuGet which references v4.0. Here’s another scenario: We reference project A with NuGet which references v4.5. As a result, our application will fail at runtime when trying to load the version that wasn’t copied.

Both DLL files are copied to the output folder, but there can be only one log4net.dll file. Here’s an example: project A might use log4net V1.1 and project B uses log4net V1.2. What to do when several of its projects depend on different version of the same assembly? So now the problem arises for a single application. These in turn, depend on dozens more and we end up with hundreds or thousands of dependencies. In the modern world, we are dependent on dozens of libraries.

This means we can store different versions of the same DLL and the different applications will load their intended version. Alternatively, we can use the GAC for shared DLL’s, which supports versioning. We will usually ship DLL files separately for each application. Then, one of the applications updated the DLL file and now the other applications no longer work. The original DLL hell issue was this: Several applications use a shared DLL file. One such problem is the infamous DLL Hell (and variations of it). Much like cockroaches, these problems resist technological advancements and increasing human knowledge. Some problems in programming seem to stay and bother us forever.
