I'm working on a project where we're including the UmbracoCms NuGet package which internally uses the log4net framework version 1.2.11 to perform logging. Now we want to add another package (SharpRaven.Log4Net) which has a dependency on log4net 1.2.15. Just installing the second NuGet package yields an exception:
Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The located assembly's
manifest definition does not match the assembly reference. (Exception from
HRESULT: 0x80131040)
This is obviously because Umbraco is referencing the 1.2.11 version and my project is now referencing the 1.2.15 version, but how do I resolve this? I can't:
- Change the version requirements of either package (really not willing to go build them from source)
- Add both references to my project as they are the same component (VS won't allow it)
- Remove the 1.2.15 version and add the 1.2.11 version. This gives me the same error, but then with the other version number.
- Create a bindingRedirect because the required log4net versinos don't not have a publicToken.
I don't really see any other options, so any help would be appreciated.
Update to clarify why it's not a duplicate question of 3158928
I'd like to stress that the issue here is that the log4net assemblies that are referenced by the NuGet packages have a PublicKeyToken of null
. The earlier question posted here Referencing 2 different versions of log4net in the same solution has some good answers, but does not have this problem and as such does not answer this question.