title: How would I force my executable to load an assembly from a different path?
body: <p>I have the following deployment structure:</p>
  
  <pre><code>deployment/
      Service1.dll
      Service2.dll
      Service3.dll
      Common.dll
      Host.exe
  </code></pre>
  
  <p>During startup, the 3 service dlls are copied to a temporary location, and I use <code>Assembly.LoadFrom</code> to load the them explicitly that way.  My code looks for changes in <code>deployment</code> and because these assemblies are loaded in their own AppDomain, I am able to shut them down, copy the new version across, and start them up again.  This works great.</p>
  
  <p>The problem I am having is that all 3 of these services depend on <code>Common.dll</code> (the main host executable does <em>not</em>).  During startup, this common dll is <em>also</em> copied to the temporary location, but the host is resolving the one in <code>deployment</code> rather than in my temporary location.</p>
  
  <p>I've tried using <code>AppDomainSetup.PrivateBinPath</code> and pointed it to my temporary location, but it is still resolving to the one in the deployment folder.</p>
  
  <p>Is there some way I can force the CLR to look in my temporary folder <em>first</em> before trying to resolve it in the deployment folder (where there are other dependencies, but none that I need to "shadow", as it were).</p>
  
  <p>EDIT: For clarification, if <code>common.dll</code> is modified, <em>all</em> the services are unloaded first to release the dependency on the common dll before copying and then restarting all 3.</p>