Monday, March 03, 2008

Visual Studio Tip

Most people don't know that devenv can be made to play well with command line automation/test run debugging. Lets say you run your test suites using the following command:

E:\temp><testexe> <args>

If a particular test fails one way out would be to open the project file corresponding to the failed test and then modify its Debug -> Launch properties and do an F5 after setting up the right paths and working directory. I usually find this tedious on big projects, so this shortcut comes in handy:

E:\temp><vsinstall-dir>\VC\vcvarsall.bat x86
Setting environment for using Microsoft Visual Studio 2005 x86 tools. 
E:\temp>devenv /debugexe <testexe> <args>

I usually have a batch file for the first step. devenv setups a nice project with the right working directory and the launch exe etc. All you have to do is load the appropriate code file, put a break point, and F5 to debug your code!