C# – Changing Output path of the Unit Test project in Visual Studio 2008

.net-2.0cunit testingvisual-studio-2008

I changed the output path of the test project, because the default path doesn't conform to our projects directory structure. After I did that, Visual Studio 2008 fails to run the tests, because it can't find the Unit Test project assembly.

What else do I have to change for the Unit Test Engine to find the assembly?

Best Answer

There are at least three ways to solve this problem

  1. Set up the output path before you run any test in the solution (as suggested by Paulius Maruška).
  2. Close the solution, delete the directory TestResults (under your solution folder) and then open the solution and run all tests (Test -> Run -> All...)
  3. Add your assembly to the list of files to deploy in the .testconfig file (suggested by Ty)

Solution number 3 is probably not recommended, since solution 1 or 2 will achieve the same without adding a second reference to the output path.

Please note that solution number 2 will delete any test history you may have.