title: Can I change a dll reference within a third-party dll?
body: <p>I've got two third-party dlls, which both are not strongly-named. I wanted to reference these dlls in <code>app.config</code> to be able to locate them once on the network and avoid copying multiple times for each application using them...As far as I understand, to reference them via <code>assemblyBinding</code> in <code>app.config</code> file they should be strongly-named:</p>
  
  <pre><code>&lt;runtime&gt;
    &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name="External"  culture="neutral" publicKeyToken="xxxx"/&gt;
      &lt;codeBase version="1.0.0.0" href="FILE://N://Lib/External.dll"/&gt;
    &lt;/dependentAssembly&gt;
  ...
  </code></pre>
  
  <p>So I need to sign them. Thanks to <a href="http://buffered.io/posts/net-fu-signing-an-unsigned-assembly-without-delay-signing/" rel="nofollow">.NET-fu: Signing an Unsigned Assembly (Without Delay Signing)</a> I managed to sign them with my <code>*.snk</code> file:</p>
  
  <pre><code>ildasm /all /out=Bar.il Bar.dll
  ilasm /dll /key=Foo.snk Bar.il
  </code></pre>
  
  <p>Then I replaced references in my solution to the signed ones and set <code>CopyLocaly</code> to <code>false</code>. Afterwards I edited the <code>app.config</code> file with the new <code>publicKeyToken</code>.</p>
  
  <p>However when running my application I still get <code>FileLoadException</code>, saying that loader cannot find one of these dlls with <code>publicKeyToken=null</code>. </p>
  
  <p>So I decided that one these dlls references the other, and that reference definetely does not know anything about the signed version of the other dll.</p>
  
  <p>Here comes the question: is there a way to change the reference inside the first dll to the signed version of the second one? Or my only options would be not to use <code>app.config</code> for these dlls and load them manually in code with, say, <code>Assembly.LoadFrom</code>?</p>