I am working on a project in which we include the UmbracoCms NuGet package, which internally uses log4net version 1.2.11 to complete registration. Now we want to add another package (SharpRaven.Log4Net), which has a dependency on log4net 1.2.15. Just installing the second NuGet package gives 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
manifest definition does not match the assembly reference. (Exception from
HRESULT: 0x80131040)
This is obviously because Umbraco is referencing version 1.2.11, and my project is now referencing version 1.2.15, but how do I solve this? I can not:
- Change the version requirements of any package (really not wanting to build them from the source)
- Add both links to my project as they are the same component (VS will not allow)
- Remove version 1.2.15 and add version 1.2.11. This gives me the same error, but then with a different version number.
- Create a bindingRedirect because the required versions of log4net do not have a publicToken.
I see no other options, so any help would be appreciated.
Refresh to clarify why this is not a duplicate question 3158928
I would like to emphasize that the problem is that the log4net assemblies referenced by the NuGet packages have a PublicKeyToken null. The earlier question posted here Link to 2 different versions of log4net in the same solution contains some good answers, but does not have this problem and, as such, does not answer this question.
source
share