title: Assembly reference version conflicts — how to resolve?
body: <p>So I have a shared Common library, which is reference RestSharp.  I used NuGet to install RestSharp so it is reference version 106.3.1.  Now, I have set Specific Version to False, I removed the version number from the csproj file reference, and I set Private to true.</p>
  
  <pre><code>&lt;Reference Include="RestSharp"&gt;
    &lt;HintPath&gt;..\packages\RestSharp.106.3.1\lib\net452\RestSharp.dll&lt;/HintPath&gt;
    &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
    &lt;Private&gt;True&lt;/Private&gt;
  &lt;/Reference&gt;
  </code></pre>
  
  <p>This common library is then referenced from my main .NET Framework 4.6.1 web application.  That web application, in turn is referencing another library from NuGet, which has a hard version dependency on RestSharp 105.1.0.0.  Because it depends on that, the web application is also now referencing RestSharp 105.1.0.0.</p>
  
  <p>Now, based on my understanding of csproj assembly references this <em>should</em> work.  It doesn't.  When I run it, I get this error at runtime when the code in the Common library (the one that references RestSharp 106.3.1) executes:</p>
  
  <blockquote>
    <p>System.IO.FileLoadException: 'Could not load file or assembly 'RestSharp, Version=106.3.1.0, Culture=neutral, PublicKeyToken=598062e77f915f75' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'</p>
  </blockquote>
  
  <p>To summarize, I am referencing two different projects from my main project.  Both of these projects take a dependency on RestSharp, but different versions.  I thought that the above csproj change should fix it but it doesn't work.</p>
  
  <p>What do I need to change to fix this DLL hell issue?  Any help here is greatly appreciated.</p>
  
  <p><strong>Update:</strong> I tried a binding redirect as suggested, like so:</p>
  
  <pre><code>&lt;dependentAssembly&gt;
       &lt;assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="en-us" /&gt;
       &lt;bindingRedirect oldVersion="105.1.0" newVersion="106.3.1.0" /&gt;
   &lt;/dependentAssembly&gt;
  </code></pre>
  
  <p>This didn't work unfortunately because there is no publicKeyToken for RestSharp 105.1.0, so now I am getting an error saying that the 105.1.0 version of the library can't be found.  Any other ideas?</p>
  
  <p><strong>Update 2:</strong> Tried removing publickeytoken and culture:</p>
  
  <pre><code>  &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name="RestSharp"/&gt;
      &lt;bindingRedirect oldVersion="105.1.0.0" newVersion="106.3.1.0" /&gt;
    &lt;/dependentAssembly&gt;
  </code></pre>
  
  <p>This also didn't work, producing:</p>
  
  <blockquote>
    <p>FileLoadException: Could not load file or assembly 'RestSharp, Version=105.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)</p>
  </blockquote>