Wednesday, December 1, 2010

Using a DllImport referenced DLL indirectly from a TestTools.UnitTesting.TestClass

Project A uses DllImport to invoke code in a third party DLL. Project B uses Microsoft.VisualStudio.TestTools.UnitTesting to run some test cases on Project A.

The automated tests in project B were failing as the DLL required by project A wasn't being copied into the TestResults directory used by the tests.

Adding the DeploymentItem attribute to the test classes in Project B with the path to the DLL revolved the issue.