title: Wrong version of System.Net.Http on build server
body: <p>I came across this article yesterday because I wanted to implement attribute routing in my MVC project.</p>
  
  <p><a href="http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2" rel="noreferrer">http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2</a></p>
  
  <p>So I went and updated as per the message from the author in the comments.</p>
  
  <pre><code>Update-Package Microsoft.AspNet.WebApi.WebHost -Pre
  </code></pre>
  
  <p>Everything is working fine on locally but it won't build on the server. The error is as follows.</p>
  
  <blockquote>
    <p>c:\BuildAgent\work\f8d76a59973cd8a9\Packages\Microsoft.AspNet.WebApi.Core.5.0.0-beta2\lib\net45\System.Web.Http.dll
    : error CS1705: Assembly 'System.Web.Http, Version=5.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses
    'System.Net.Http, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than
    referenced assembly 'System.Net.Http, Version=2.0.0.0,
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
    [C:\BuildAgent\work\f8d76a59973cd8a9\Aggregator\Spin.TradingServices.Aggregator.Web\Spin.TradingServices.Aggregator.Web.csproj]</p>
  </blockquote>
  
  <p>I kind of understand what's going on and found a few things to do with other peoples questions on here, but none of them seem to work. I'd rather find a solution which only requires changes to the project and not the server.</p>
  
  <p>So far I have:</p>
  
  <ol>
  <li><p>Set copy local to true, for System.Net.Http</p></li>
  <li><p>Set up binding redirect.</p>
  
  <pre><code>&lt;assemblyIdentity name="System.Net.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
  &lt;bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /&gt;
  </code></pre></li>
  </ol>
  
  <p>Thanks, hope someone can help.</p>