Visual Studio 2010 External Tools - How to automatically attach a debugger to the tool when it is started?
I am writing a DirectShow filter, and when I want to debug it I must:
- Run GraphStudio (开发者_运维问答or GraphEdit) from Tools (I added it to external tools)
- Click on Debug > Attach to process...
- Search for "GraphStudio" in the process list
- Double click on it...
Can this be automated in VisualStudio 2010? Like, I want to select an external tool from Tools menu, and get the debugger automatically attached to it...?
This isn't perfect but it saves you a couple of steps.
In Solution Explorer, right click on your project and select properties. Now select the debugging tab. Change the Command line from $(TargetPath) to GraphStudio.exe (or whatever your process name is). Change the Attach line from No to Yes. Click on OK.
Now your steps are
- Run GraphStudio from Tools
- Press F5 (or Start | Debug).
The debugger will attach to the process identified by the Command line entry. If there is more than one GraphStudio running it will attach to all of them.
If you don't need to run GraphStudio as an external tool then you can simplify things even further by changing the Attach line back to No and changing the Command line to hold the full pathname of the tool you want to run. If needed you can also set working directory and Command Arguments (switches etc.)
Now just start a debugging session by pressing F5. the debugger will run Graphstudio for you and will attach to that copy only.
You can use gflags
or IFEO
to do this. I mention it in this answer.
精彩评论