I’ve been doing a bit of work recently to create custom work item controls. Debugging these is tricky but you can make two configuration changes to make debugging these as easy as debugging any executable.
The first change is to configure your custom work item controls project to copy its outputs to the directory where Visual Studio Team System 2008 will look for them. To do this:
- Open the project properties.
- Switch to the Compile tab.
- Click Build Events.
- In the Post-Build Event Command Line enter:
copy /Y "$(TargetDir)*.*" "$(UserProfile)\AppData\Local\Microsoft\Team Foundation\Work Item Tracking\Custom Controls\9.0\"
This will copy the contents of the project’s output directory to the directory where Visual Studio Team System 2008 looks for custom controls. This uses the user’s profile directory instead of the all user’s profile because writing to the user’s profile doesn’t require administrative privileges.
The second change is to configure the project to launch Visual Studio as the process to debug. To do this:
- Open the project properties.
- Switch to the Debug tab.
- Select Start External Program.
- Browse to devenv.exe (usually C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe).
Now, when you press F5 your custom controls project will be compiled, the output copied to the directory where Visual Studio Team System looks for custom controls, and then Visual Studio Team System 2008 will be launched with the debugger attached. This will give you full debugging capability including breakpoints.
