I'm facing the following problem (or a challenge, if one prefers to call it this way): in our C# desktop application we have two vendors of additional data processing libraries (both developed with MATLAB, different versions though). Each of the libraries depends on MathWorks' MWArray.dll, each needs a different version of.
Let me show you a sketch of the situation:
What I know for sure (tested) is:
- both libraries can be called individually without any problems
- two versions of MRC (Matlab Runtime Compiler) can coexist and don't cause interference problems (see above)
- a library compiled against older version of MWArray.dll cannot be used with a newer version
What I've already tried:
- using library aliases, as described in this MSDN blog article
- placing the libraries in separate projects with separate references - it all gets mixed in the obj folder
searching SO for similar issues - they either address 1st degree dependencies ambiguity (while my problem would be 2nd degree dependency ambiguity) or handle the problem of the libraries that are either (backwards) compatible or open-source, thus those don't solve my problem:
- C# Referencing two different versions of same assembly
- Reference to Projects which have references to the same dll with different versions
- Use different versions of dll file in one app
- .Net dll reference - deployment onto PCs with different versions of 3rd party dll
EDIT: suggested solutions I've already tried (still those don't work):
using assembly runtime binding - my App.config file was enriched with:
<runtime>
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentassembly>
<assemblyidentity name="MWArray" publickeytoken="e1d84a0da19db86f" />
<bindingredirect oldVersion="0.0.0.0-2.17.0.0" newVersion="2.17.0.0" />
<codebase version="2.17.0.0" href="C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MWArray\v4.0_2.17.0.0__e1d84a0da19db86f\MWArray.dll" />
<codebase version="2.18.0.0" href="C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MWArray\v4.0_2.18.0.0__e1d84a0da19db86f\MWArray.dll" />
</dependentassembly>
</assemblybinding>
</runtime>
- I've placed both versions of MWArray.dll in "Resources" path (one named MWArray.2.17.0.0.dll, the other MWArray.2.18.0.0.dll), added both as references, edited App.config accordingly. Now Library1 crashes complaining it cannot initialise MWArray. Which is logical since it cannot find MWArray.dll since only some MWArray.x.x.x.x.dll are available.
I will appreciate any hints or tips on handling this issue, a working solution would, of course, be the best.
Again - it's not my code that needs to reach MWArray, it's the vendor's code I'm referencing.