title: The new DLL Hell; wrong assembly version being bound
body: <p>I'm running VS2013 update 1 with Nuget v 2.8.50313.46</p>
  
  <p>You can skip to <strong>this is the important bit</strong>, and some recent updates, and come back for reference.</p>
  
  <p>I have a VS solution, this is a simplified representation of it.</p>
  
  <pre><code>-- Solution
      - Base (Class Library)
          Packages:
              No Packages Installed.
          References:
              System
              System.Configuration
              System.Core
              System.Runtime.Caching
              System.Web
  
      - AppBase (Class Library)
          Packages:
              No Packages Installed.
          References:
              System
              System.Core
              System.Web.Http
              Base
  
      - Client (Console Application)
          Packages:
              EntityFramework                v6.1.0
              HtmlAgilityPack                v1.4.6
          References:
              EntityFramework
              EntityFramework.SqlServer
              HtmlAgilityPack
              System
              System.Core
              AppBase
              Base
  
      - Server (Web Application)
          Packages:
              HtmlAgilityPack                v1.4.6
              Microsoft.AspNet.WebApi        v5.1.2
              Microsoft.AspNet.WebApi.Client v5.1.2
                  (dependent on &gt; Newtonsoft.Json v4.5.0)
              Microsoft.AspNet.WebApi.Web... v5.1.2
              Newtonsoft.Json                v6.0.3
          References:
              HtmlAgilityPack
              Newtonsoft.Json
              System
              System.Net.Http
              System.Net.Http.Formatting
              System.Web
              System.Web.Http
              System.Web.HttpHost
              AppBase
              Base
  </code></pre>
  
  <p>The code inside the <code>Server</code> needs <code>Newtonsoft.Json v6.0.3</code> to function.</p>
  
  <p>When I rebuild all and run everything works fine, as expected.</p>
  
  <p>I subsequently build just <code>AppBase</code>, without building <code>Server</code>. <code>AppBase</code> is dependent only on <code>Base</code>.
  The binaries for <code>AppBase</code> and <code>Base</code> are "up-to-date", as expected.</p>
  
  <p>However,</p>
  
  <p><strong>this is the important bit</strong>,</p>
  
  <p>the building of <code>AppBase</code> causes the <code>Newtonsoft.Json.dll</code> in the "Server\bin" folder to be substituted for the earlier 4.5 version.</p>
  
  <p>When I make a request to the <code>Server</code>, a "500 Intrernal Server Error" is returned due to the binding error caused by the incorrect <code>Newtonsoft.Json</code> dll version.  </p>
  
  <p>Why does building an assembly effect a non dependent assembly?</p>
  
  <p>Has anybody else experienced this?</p>
  
  <p>What is the best way to resolve this problem?</p>
  
  <hr>
  
  <p><strong>EDIT</strong> 19/06/2014</p>
  
  <p>I made a new solution file, at first I thought this had resolved the problem.
  However the problem had transferred to the <code>System.Net.Http.Formatting.dll</code> :-S</p>
  
  <p>If I edit <code>AppBase</code> so it does not reference <code>System.Web.Http</code> the effect goes away.
  Maybe this is something to do with the MVC stuff in Program Files? ... </p>
  
  <hr>
  
  <p><strong>EDIT</strong> 20/06/2014</p>
  
  <p>I've posted a <a href="https://stackoverflow.com/a/24324248/659190">community wiki answer</a> that details how I've worked around the problem. I thought somebody might find it useful. However, the workaround doesn't explain what mechanism is effecting <code>Server</code> when I build only <code>AppBase</code> and <code>Base</code>. Does this sound like a bug, it seems wrong?</p>