Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin Blake 23 posts 45 karma points
    Aug 31, 2012 @ 13:53
    Kevin Blake
    0

    Installing Courier alongside other log4net dependencies

    We recently had a problem installing Courier (2.7) into an umbraco site that was already using log4net 2.0.0.0 in other parts of the project.

     

    [FileLoadException: Could not load file or assembly
    'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821'
    or one of its dependencies. The located assembly's manifest definition does not
    match the assembly reference. (Exception from HRESULT: 0x80131040)]

     

    It turns out the solution is quite straightforward, to run both versions of log4net side by side.

    Copy the log4net 1.2.10.0 dll to a directory in your web project (you don't need to add a reference to it), e.g.

    wwwroot\log4net-1.2\log4net.dll

    Now add to your web.config:

     

    <configuration>
      <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\log4net.dll" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration

    Then install Courier, and everything should work correctly.  Hope this helps someone else.

    Credit to Joel Gauvreau on Stackoverflow for the solution:
    http://stackoverflow.com/questions/3158928/referencing-2-differents-versions-of-log4net-in-the-same-solution

     

     

Please Sign in or register to post replies

Write your reply to:

Draft