I am creating a test project in Visual Studio 2010 for my existing project. I have added reference of one DLL that is being used in the project for which I am creating this test project.
Now problem is, after adding the reference of that DLL, when I am trying to execute the test, then I am getting a run time exception as
System.IO.FileNotFoundException: Could not load file or assembly
'SOME NAME, Version=2.5.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified
I have solved this issue by changing Copy Local attribute of that reference to True. But I dont want to change it to true. Because I dont want to make copy of this in test project’s debug folder.
Is there any other way to do so?
This is an important question I asked myself some years ago and found the following practical solution:
$root$\bin\Debug$root$\binApp.configfile that looks like the content below (note that I include in the probing paths,.\Debugof course, but also.\NUnit\binbecause I put the NUnit assemblies there)<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
<runtime>
<assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
<probing privatePath=”Debug;NUnit\bin” />
</assemblyBinding>
</runtime>
</configuration>
Btw, just never use
Copy Local = true, I wrote white books on this topic (it can slow down compilation time up to 10 times!)