title: Asp core wrong assembly redirect on publish
body: <p>When publishing my asp core project using visual studio a <code>.config</code> file is created alongside my executable.</p>
  
  <p>The <code>.config</code> includes a couple of <code>bindingRedirect</code> like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="6.0.0.0" newVersion="8.0.0.0" /&gt;
          &lt;bindingRedirect oldVersion="7.0.0.0" newVersion="8.0.0.0" /&gt;
          &lt;bindingRedirect oldVersion="6.0.0.0" newVersion="9.0.0.0" /&gt;
          &lt;bindingRedirect oldVersion="8.0.0.0" newVersion="9.0.0.0" /&gt;
          &lt;bindingRedirect oldVersion="7.0.0.0" newVersion="9.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Serilog" publicKeyToken="24c2f752a8e58a10" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="1.5.0.0" newVersion="2.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="1.1.37.0" newVersion="1.2.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="1.2.0.0" newVersion="1.3.0.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Here I want to change the <code>bindingRedirect</code> for <code>Newtonsoft.Json</code> to: </p>
  
  <pre><code>&lt;dependentAssembly&gt;
    &lt;assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /&gt;
    &lt;bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /&gt;
  &lt;/dependentAssembly&gt;
  </code></pre>
  
  <p>According to this blog post: <a href="http://blog.rytmis.net/2016/03/29/asp-net-core-and-assembly-binding-redirects/">http://blog.rytmis.net/2016/03/29/asp-net-core-and-assembly-binding-redirects/</a> I should be able to create an <code>App.config</code> and specify the binding there. However, I cannot get it to work. When I add one it still produces the same <code>.config</code>.</p>
  
  <p>Any ideas?</p>
  
  <p><em>NOTE</em>: I could create a <code>.config</code> file in my project with the same name as my executable and with the correct <code>bindingRedirect</code> and then edit the <code>publishOptions</code> in my <code>project.json</code> file to include it. Then I would manually have to add all the other future <code>bindingredirect</code>.</p>