title: Could not load file or assembly 'System.Diagnostics.DiagnosticSource on ASP.Net Core migration from VS2015 to VS2017
body: <p>I have a web in ASP.Net Core (4.6.1 framework) that uses Facebook and MS external login that I created with Visual Studio 2015 and opened in the new Visual Studio 2017 that came out yesterday. VS2017 made a few changes related to the csproj, project.json, etc files.</p>
  
  <p>The site compiled and executed fine except for one part. If I did a Facebook or Microsoft external login, the site displayed this trap:</p>
  
  <pre><code>FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  
  System.Net.Http.WinHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  AggregateException: Unhandled remote failure.
  
  Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler+&lt;HandleRemoteCallbackAsync&gt;d__6.MoveNext()
  </code></pre>
  
  <p>The url in the browser showed that it was attempting to return from the external login to the local (<a href="https://localhost:44321/signin-facebook?code=" rel="noreferrer">https://localhost:44321/signin-facebook?code=</a>... or /signin-microsoft).</p>
  
  <p>The version number of the System.Diagnostics.DiagnosticSource.dll (and System.Net.Http.dll) is 4.6.24705.1.</p>
  
  <p>I started a new VS2017 project from scratch with Facebook and MS login added and it worked fine - getting me logged on without the trap. The dll's were the same versions.</p>
  
  <p>Comparing the two csproj files showed differences but nothing obvious (nothing related to System dlls):</p>
  
  <p><a href="https://i.stack.imgur.com/pjoNZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pjoNZ.png" alt="Differences in csproj file"></a></p>