title: How do I stop Nhibernate log4net conflicting with existing log4net?
body: <p>I'm very new to this so I apologise if my question isn't well structured or just in the wrong place, etc. I've had a good look for solutions to this and tried a number of different approaches but haven't found anything that works so....</p>
  
  <p>I have a solution that makes use of Nhibernate, and consequently must use log4net V1.2.10.0, which comes in the log4net/2.0/ folder. However my solution also links to a number of other solutions, to which I have very limited access. These make use of the same log4net V.1.2.10.0 but in folder: log4net/1.2/ </p>
  
  <p>When I run my solution I get this error. </p>
  
  <pre><code>{"Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, 
  PublicKeyToken=e27b8fa57f63a98d' or one of its dependencies. The located assembly's 
  manifest definition does not match the assembly reference. (Exception from HRESULT: 
  0x80131040)":"log4net, Version=1.2.10.0, Culture=neutral, 
  PublicKeyToken=e27b8fa57f63a98d"}
  </code></pre>
  
  <p>I have tried to amend the solutions that it is calling, however each time I amend one I get the error within that solution as soon as it tries to use another solution, so I have to amend another and so on. There are simply too many solutions to amend and too many interdepencies with other solutions that I have absolutely no control over for me to be able to change them all so that they use log4net/2.0. </p>
  
  <p>I have found another question ( <a href="https://stackoverflow.com/questions/3158928/referencing-2-differents-versions-of-log4net-in-the-same-solution">Referencing 2 different versions of log4net in the same solution</a> ) which I think is basically the same problem, and they amend the app.config with a binding, however I can't seem to get this right, as I'm still getting the same error. The binding I've included in my app.config is this:</p>
  
  <pre><code>&lt;runtime&gt;
  &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
    &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name="log4net" publicKeyToken="e27b8fa57f63a98d" /&gt;
      &lt;codeBase version="1.2.10.0" href="2.0\log4net.dll" /&gt;
    &lt;/dependentAssembly&gt;
    &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821"/&gt;
      &lt;codeBase version="1.2.10.0" href="1.2\log4net.dll" /&gt;
    &lt;/dependentAssembly&gt;
   &lt;/assemblyBinding&gt;
  &lt;/runtime&gt;
  </code></pre>
  
  <p>I'm not sure what the answer to the other question means when it says "You create 2 folder in your project one for each version of log4net. You place each log4net.dll in its corresponding folder by adding an the file to the solution (not with add reference). You can set the copy to output directory property to copy always so that it is automatically copied to the output folder when you build." And would I need to do this to every solution that my solution references? </p>
  
  <p>Ideally I want to be able to make an amendment to my solution which simply means that it doesn't care what log4net any of the solutions are using but they can still pass log messages between each other. I assume this is possible, so any help would be hugely appreciated. Either that or how do I turn off nHibernate's logger so that it doesn't care what log4net I'm using so I can just continue to use the log4net/1.2 that all the other solutions are using. I've tried all sorts of things to turn it off but it still seems to end up trying to find the log4net/2.0.</p>