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.
4

1 回答 1

0

Visual Studio 2010 和更新版本提供了一种内置机制来回答问题中的特定场景,即一种在特定文件的特定行中轻松设置断点的方法。

该机制在VS 2010 Debugger Improvements (BreakPoints, DataTips, Import/Export)中有很好的描述。

此屏幕截图的 VS 2010 将断点导出到 XML 文件 - 然后您可以与其他开发人员共享,或稍后重新加载:

在此处输入图像描述

还有一个相应的“从文件导入断点”按钮。

于 2013-11-07T21:13:07.527 回答