I have created two projects in a solution Main and CodeUITestProject.The Main project is a Windows application and it is going to call the test cases defined in CodeUITestProject.

I run the Windows Form application, if failed. However when I run the test case alone in the project CodeUITestProject, it works fine. I use VS2012 as development environment.

Exception screen

References of DLLs.

I also attached the whole VS2012 project at here.