Somehow I've been lucky and never had to deal with this problem, even though I think it's a common one:
I've got a web project, let's call it SomeProject
. SomeProject
has a reference to a 3rd party library, let's call it SomeThirdParty
, version 1.0. SomeProject
also has a reference to a home-grown class library, let's call it SomeLibrary
. SomeLibrary
also has a reference to SomeThirdParty
, but a different version (let's say 2.0).
Version 1.0 and 2.0 of SomeThirdParty
share most of the same signatures, but are different implementations. I need SomeProject
to use the 1.0 implementation, and SomeLibrary
to use the 2.0 implementation if possible.
I compile SomeProject
using its reference to log4net. The DLL that ends up in the bin directory is the one that SomeProject
references. At runtime, when code from SomeLibrary
runs, it attempts to execute the code from version 2.0 of SomeThirdParty
, and of course fails, throwing a FileLoadException: Could not load file or assembly '
SomeThirdParty, Version=2.0.0.0, Culture=[etc.]' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
Obviously I could upgrade SomeProject
to the newer DLL or downgrade SomeLibrary
to the older DLL, but it wouldn't be ideal for many reasons.
I think the right answer involves installing SomeThirdParty in the GAC, but I'm not sure exactly how I'd go about doing this, and how it would affect other developers and servers.
Any suggestions you may have are appreciated.
Thanks for the help.