title: Could not load file or assembly 'System.Net.Http.Formatting-Cosmo'
body: <p>This error just started happening out the blue.  Using Visual Studio 2017, the System.Net.Http.Formatting problem has not been brought up for several years.  </p>
  
  <p>I only see this message on the webpage:</p>
  
  <blockquote>
    <p>Could not load file or assembly 'System.Net.Http.Formatting-Cosmo' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)</p>
  </blockquote>
  
  <p>Along with a traceback:</p>
  
  <pre><code>     === Pre-bind state information ===
   LOG: DisplayName = System.Net.Http.Formatting-Cosmo
    (Partial)
   WRN: Partial binding information was supplied for an assembly:
   WRN: Assembly Name: System.Net.Http.Formatting-Cosmo | Domain ID: 2
   WRN: A partial bind occurs when only part of the assembly display name is provided.
   WRN: This might result in the binder loading an incorrect assembly.
   WRN: It is recommended to provide a fully specified textual identity for the assembly,
   WRN: that consists of the simple name, version, culture, and public key token.
   WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
   LOG: Appbase = file:///C:/Users/George/OneDrive/SignupList/SignupList/
   LOG: Initial PrivatePath = C:\Users\George\OneDrive\SignupList\SignupList\bin
   Calling assembly : (Unknown).
   ===
   LOG: This bind starts in default load context.
   LOG: Using application configuration file: C:\Users\George\OneDrive\SignupList\SignupList\web.config
   LOG: Using host configuration file: C:\Users\George\OneDrive\IISExpress\config\aspnet.config
   LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
   LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
   LOG: Attempting download of new URL file:///C:/Users/George/AppData/Local/Temp/Temporary ASP.NET Files/vs/6cc2628d/51b3c1a6/System.Net.Http.Formatting-Cosmo.DLL.
   LOG: Attempting download of new URL file:///C:/Users/George/AppData/Local/Temp/Temporary ASP.NET Files/vs/6cc2628d/51b3c1a6/System.Net.Http.Formatting-Cosmo/System.Net.Http.Formatting-Cosmo.DLL.
   LOG: Attempting download of new URL file:///C:/Users/George/OneDrive/SignupList/SignupList/bin/System.Net.Http.Formatting-Cosmo.DLL.
   WRN: Comparing the assembly name resulted in the mismatch: NAME
   ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
  </code></pre>
  
  <p>Seems to stop in trying to find System.Net.Http.Formatting which has the right version for the DLL in the config.</p>
  
  <pre><code>  &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
      &lt;bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
    &lt;/dependentAssembly&gt;
  </code></pre>
  
  <p>I am using ASP.NET but not MVC, I have no idea why System.Net.Http.Formatting is needed. Cosmo is the name of my computer. I hope the -Cosmo is not an issue, I do not understand why is there.</p>
  
  <p>I did everything mentioned in the previous 4-year-old post in Stack Overflow - <a href="https://stackoverflow.com/questions/22403650/could-not-load-file-or-assembly-system-net-http-formatting-or-one-of-its-depen">Could not load file or assembly &#39;System.Net.Http.Formatting&#39; or one of its dependencies. The system cannot find the path specified</a> 
  with nothing solving it. I found other posts and played with Microsoft.AspNet.WebApi.Core V 5.2.4 which puts System.Net.Http.Formatting V 5.2.3.0.</p>
  
  <p>The Local Copy property is set to True on the System.Net.Http.Formatting Reference. All the packages her been re-got. The project has been re-initialized.  I have tried everything suggested that I could find.</p>
  
  <p>Without Microsoft.AspNet.WebApi.Core, if I compile I get compile errors complaining about System.Net.Http.Formatting missing. Add Core back and the errors disappear compiling fine.  I must also remove and re-add Microsoft.AspNet.WebApi.WebHost with Microsoft.AspNet.WebApi.Core because of dependencies. The webpage when running it gives the error along with as well as on the top line of every single ASPX file in my project.</p>
  
  <p>I also have Newtonsoft.Json which I have seen related to this.</p>
  
  <pre><code>      &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-2014.3.1209.45" newVersion="2014.3.1209.45" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Google.Apis" publicKeyToken="4b01fa6e34db77ab" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Google.Apis.Core" publicKeyToken="4b01fa6e34db77ab" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
  </code></pre>
  
  <p>The assembly is looking for System.Net.Http.Formatting-Cosmo and attempting to download it. System.Net.Http.Formatting is sitting in bin, and I even added System.Net.Http.Formatting-Cosmo just in case. The versions match. Why is it not finding the bin DLL? Is -Cosmo a problem?</p>
  
  <p>Puzzling.</p>
  
  <p>George</p>