Using both signed versions of log4net

Older versions of log4net has been signed with a different certificate than the new versions of log4net. That means that they have different public tokens and regular <assemblyBinding> doesn’t work. This post will show you have you can use both versions side-by-side.

To be able to do that you need to do the following:

  1. Start by downloading the old version (version of 1.2.11.0).
  2. Rename the downloaded binary to log4net.1.2.10.dll.
  3. Include it in your startup project with Build action set to None and “Copy if newer”
    5x08d

  4. Tell .NET where it can find the old version App.config:

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" />
                <codeBase version="1.2.10.0" href="log4net.1.2.10.dll" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
    

    The href attributes identifies where the old version is. Hence all other requests for log4net will point on the new version.