I'm in the seventh circle of DLL hell.
Here's my situation:
- Class library project needs to use some DLLs, call them A.dll and B.dll.
- A.dll depends on log4net.dll, so I have to include that one too.
- If B.dll is not referenced, or if all uses of it are commented, log4net.dll is loaded (I can see it in the Modules window at runtime) and everything works correctly.
- The moment I add and use B.dll I get an exception. A.dll says it can't find log4net.dll, and if I look in the Modules window I can see that log4net.dll is indeed not there.
Things I've tried:
- Placing A.dll in a dedicated folder along with its log4net.dll does not help.
- Installing the log4net NuGet package instead of using the log4net.dll does not work.
- However installing the log4net NuGet package in the projects that use myClass Library solves the problem (but I can't require users of my library to install the log4net NuGet).
It looks like if I use B.dll the log4net.dll stops being loaded, and I don't understand why. My best guess is that B.dll includes a version of log4net itself which conflicts with the one I load for A.dll, but then why doesn't it show up in the Modules window?
Additional information:
- A is Modbus.dll, and B is Regatron.G5.dll. I use them to control some machines.
- Modbus.dll requires 1.2.10.0.
- My class library uses NET 4.7.2. I also have a console project that I use to test my library, which uses 4.7.2 as well.