title: Why do I get "System.IO.FileNotFoundException: Could not load file or assembly" when setting reference to "copylocal=false"?
body: <p>Here is the situation: I am trying to run unit tests using a test project that I'll call "TestProject". It is testing a class in another project that I'll call "Class1" and "Project1".</p>
  
  <p>Project1 does some dynamic lazy-loading of various dll's at runtime, which I will call "TheDynamicDLLs". Project1 finds these dll's by looking in a directory relative to its own build output path.</p>
  
  <p>The first part of the problem arises when TestProject references Project1. Obviously, it copies the newly built Project1.dll to its OWN build directory, and then when Project1.dll looks for TheDynamicDLLs in the path relative to its location, it can't find them, because it is running from TestProject's location, not its own.</p>
  
  <p>To fix this, I went to TestProject's references, right clicked the Project1 reference, and opened up its properties. I then set "Copy Local" to "False". I also made sure that the reference's "Path" property was the same as Project1's build path.</p>
  
  <p>Now I have a new problem, and I can't even figure out what it is. Whenever I run the unit test, it fails with a report of "System.IO.FileNotFoundException: Could not load file or assembly [information naming Project1 as the un-findable assembly]".</p>
  
  <p>Furthermore, when I try to debug the unit test, instead of just running it, it never throws an exception, or complains, or anything, thereby preventing me from finding out any further info about the problem. I can't find any further helpful info in the test report either.</p>
  
  <p>Here is the full test report with names and such swapped out for confidentiality purposes:</p>
  
  <pre><code>Test Name:  Class1_Tests
  Test FullName:  TestProject.TestClass.Class1_Tests
  Test Source:    c:\Code\Solution1\Tests\TestProject\TestClass.cs : line 175
  Test Outcome:   Failed
  Test Duration:  0:00:00.0348455
  
  Result Message: 
  Test method TestProject.TestClass.Class1_Tests threw exception: 
  System.IO.FileNotFoundException: Could not load file or assembly 'Project1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.=== Pre-bind state information ===
  LOG: DisplayName = Project1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
   (Fully-specified)
  LOG: Appbase = file:///C:/Code/Solution1/Tests/TestProject/bin/Debug
  LOG: Initial PrivatePath = NULL
  Calling assembly : TestProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
  ===
  LOG: This bind starts in default load context.
  LOG: Using application configuration file: C:\Code\Solution1\Tests\TestProject\bin\Debug\TestProject.dll.config
  LOG: Using host configuration file: 
  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:/Code/Solution1/Tests/TestProject/bin/Debug/Project1.DLL.
  LOG: Attempting download of new URL file:///C:/Code/Solution1/Tests/TestProject/bin/Debug/Project1/Project1.DLL.
  LOG: Attempting download of new URL file:///C:/Code/Solution1/Tests/TestProject/bin/Debug/Project1.EXE.
  LOG: Attempting download of new URL file:///C:/Code/Solution1/Tests/TestProject/bin/Debug/Project1/Project1.EXE.
  Result StackTrace:  at TestProject.TestClass.Class1_Tests()
  </code></pre>
  
  <p>From the logs, it looks like TestProject is STILL trying to load Project1's dll from its OWN #$%^ing build path despite my EXPLICITLY telling it NOT to copy local. (grrrr...)</p>
  
  <p>What am I doing wrong?</p>