Search code examples
c#.net-assemblynlogassembly-binding-redirect

Conflict of version for NLog


I am trying to compile my project named MyAssembly, and when including other assembly named ExternalAssembly that also references NLog, I get the following error :

Assembly ExternalAssembly, Version=1.0.0.0 uses NLog, Version=2.1.0.0 which has a higher version than referenced assembly NLog, Version=2.0.0.0

I went to my app config and added the following entry:

<?xml version="1.0"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="NLog" publicKeyToken="5120E14C03D0593C" culture="neutral"/>
            <bindingRedirect oldVersion="2.0.0.0" newVersion="2.1.0.0"/>
        </dependentAssembly>      
        ...

But I still get the same error.

Any ideas about why it is not working, and how to fix this error?


Solution

  • To solve this issue I had to upgrade the NLog reference of my project to match the one of the third party (2.1.0.0).