1

I've just learned about Visual Studio 2010's Command Window, and am hoping it might be able to automate a short set of tedious steps.

Is it possible to put several Command Window commands into a file and execute them?

The scenario I have in mind is:

  • open a particular source file (hard-coded path is known)
  • set a breakpoint at a particular (fixed) line number in that file

I want to be able to do this easily in a given, open solution - without having to go to the line number by hand, and set the breakpoint by hand.

(The line is the point where a null smart-pointer is dereferenced, and so is a very common location for breakpoints.)

Edit - possible alternatives

  • Recording a macro - I almost mentioned in the original post that I'd considered a macro, but I was wanting to version-control the commands, and macros are binary files, so not amenable to version control
  • Creating an add-in - Creating source-code and a DLL, to run some simple commands seems unnecessarily complex to me.
Clare Macrae
  • 3,670
  • 2
  • 31
  • 45
  • Have you considered creating a Visual Studio [addin](http://msdn.microsoft.com/en-us/library/80493a3w%28v=vs.100%29.aspx) or [recording a macro](http://msdn.microsoft.com/en-us/library/7kyhdt1z%28v=vs.100%29.aspx) – Blachshma Jan 09 '13 at 22:30
  • @Blachshma Thank you for the comment. My reply got a bit long, so I added it to the question... – Clare Macrae Jan 10 '13 at 21:19

1 Answers1

0

Visual Studio 2010 and newer provide a built-in mechanism to answer the specific scenario in the question, namely a way to easily set a break-point in a specific line in a specific file.

The mechanism is well-written up in VS 2010 Debugger Improvements (BreakPoints, DataTips, Import/Export).

This screenshot whose VS 2010 exporting breakpoints to XML files – which you can then share with another developer, or re-load later:

enter image description here

There is also a corresponding "Import breakpoints from a file" button.

Clare Macrae
  • 3,670
  • 2
  • 31
  • 45