How to load side by side same name DLLs (Visual Studio)

338 Views Asked by At

I have a question about side-by-side assemblies.

Here's the situation:

I have an executable, app.exe, which loads plugins by searching a plugins directory. app.exe depends on a certain A.dll.

I'm developing a plugin which depends on an older, customized version of A.dll that has the same name. Updating this older, customized version to the newer version is impossible, so I thought I might be able to load the two A.dll files simultaneously.

Here's the directory structure:

\bin
    app.exe
    A.dll (newer version)
    \plugins
        myplugin.dll

Both versions of A.dll themselves depend on a huge number of other DLLs, which could have similar version problems. (I should also mention I'm working with a 64-bit application, if that makes a difference.)

How do I set this up in Visual Studio such that I can load both A.dll libraries at the same time, so that myplugin.dll uses the older version, whereas app.exe uses the newer version?

1

There are 1 best solutions below

2
David Heffernan On

Since these are plugins, you load them by calling LoadLibrary, or similar. In which case you can simply pass the full path to the DLL in order to load it.