8

I just upgraded log4net in my project and am having some assembly binding issues because a component relies on an older version of log4net.

The version expected by the component is

log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821

The version I have is

log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a

How do I cause this binding to resolve properly (there is only one api difference and it should not matter for this component).

I have tried adding the following to my web.config but it does not work.

  <dependentAssembly>
    <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" />
    <bindingRedirect oldVersion="1.2.10.0" newVersion="1.2.12.0" />
  </dependentAssembly>
George Mauer
  • 117,483
  • 131
  • 382
  • 612

1 Answers1

9

I don't believe it's possible to perform a binding redirect to an assembly with a different public key.

  1. You'll need to download the version of log4net v1.2.12.0 that is signed with the old key (http://psg.mtu.edu/pub/apache//logging/log4net/binaries/log4net-1.2.12-bin-oldkey.zip)

  2. Then update your code, replacing references to:

    log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a

    with

    log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=1b44e1d426115821

On a related note: you can put a version range in the redirect oldVersion="0.0.0.0-1.2.11.0", for added flexibility.

2Toad
  • 14,799
  • 7
  • 42
  • 42
  • I've also [found a way to include both assemblies side by side.](http://stackoverflow.com/questions/3158928/referencing-2-differents-versions-of-log4net-in-the-same-solution/3163050#3163050) [Ugh](http://stackoverflow.com/questions/8743992/how-do-i-work-around-log4net-keeping-changing-publickeytoken) – George Mauer Oct 15 '13 at 17:34