显然,Visual Studio 2012中删除了宏。

有没有插件/扩展/工具可以让我录制和播放键盘宏(就像Visual Studio 2010中的录制/播放临时宏一样)?

例如,在将代码从一种语言转换为另一种语言或从文本列表中快速生成属性等时,我通常会使用宏。


In this version of Visual Studio, while there are literally hundreds of features, there are some we’ve actually taken out. One of those is the macros automation feature, including macro record/replay, macro projects and the Macros IDE. While we know that macros have been valuable for those who use them, unfortunately our usage data shows that less than 1% of Visual Studio developers take advantage of this feature. Therefore, we’ve found ourselves investing more deeply in the Visual Studio areas that get used every day, and have not updated macros for several releases.

来源:Visual Studio 11开发者预览中的宏

我已经开始绕过这个(虽然不方便)通过剪切/粘贴到notepad++,记录和运行宏,然后剪切/粘贴回Visual Studio 2012。


你可以尝试文本宏for Visual Studio 2012-2022扩展(我是作者)。它基本上做的事情与notepad++宏相同(文本编辑,没有UI自动化)。

代码是开源的(GitHub),所以请随时贡献改进:-)


自从使用Sublime Text后,我发现实际上有比使用宏更好的方法来编辑文本。

Sublime允许您一次用多个游标编辑文本。这很难解释,但在http://www.sublimetext.com上有几个动画展示了它

我还添加了Sublime作为Visual Studio的外部工具:

打开工具/外部工具 添加:Sublime,选择exe并使用这些参数:$(ItemPath):$(CurLine):$(CurCol) (也移动到顶部,因为这使下一步更容易,否则请记住它的位置) 然后进入自定义/键盘,搜索工具。ExternalCommand1并添加您首选的键盘快捷方式。

这将在Sublime中打开当前文档,光标位置与你在VS中的位置相同。

(同时,Sublime可以做宏,以防你仍然需要它们)


站出来投票支持把宏带回来!

http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2650757-bring-back-macros

更新(10/4/2013):

耶!感谢您的投票宏现在考虑返回!继续推动!

我们目前正在评估在Visual Studio的未来版本中提供脚本功能的可行性。在我们研究这个建议时,请继续就我们应该提供什么样的脚本功能提出您的意见。 Tony Goodhew, VS Pro项目经理。


Visual Commander扩展(由我开发)支持Visual Studio 2015/2017/2019中的代码编辑宏录制和回放。


VSScript允许在Lua中记录、编写和编辑宏,尽管我还不能让它与Visual Studio 2015一起工作(命令按钮是灰色的;文档说Visual Studio 2005到2015 RC是支持的)。

它目前是作为免费软件发布的。


我刚刚注意到微软发布了Visual Studio 2013的扩展来再次支持宏的back:

https://visualstudiogallery.msdn.microsoft.com/d3fbf133-e51b-41a2-b86f-9560a96ff62b

我建议大家还是投票支持这个功能,鼓励他们在Visual studio 2015中也可以使用这个扩展: https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2650757-bring-back-macros


Visual Commander扩展可以让您自动执行Visual Studio中的重复任务。


宏又回来了!

Under Review → Completed We’ve heard your feedback loud and clear, and we’ve been working on a solution. We’re therefore very happy to announce that we’ve now released a version of Macros that supports both Visual Studio 2015 and Visual Studio 2013. While we were at it, we took the opportunity to fix a couple of bugs and improved the keyboard shortcuts. We hope you enjoy it. For more information, see the blog post here: http://aka.ms/vsmacros We’ve also open-sourced the code under the MIT license. If you have any suggestions or contributions, feel free to create an issue or a pull request in the new GitHub repo: http://github.com/Microsoft/VS-Macros Justin Clareburt Senior Program Manager

用于Visual Studio的宏

Macros for Visual Studio是Visual Studio 2013和Visual Studio 2015的扩展,允许使用宏来自动化IDE中的重复任务。该扩展可以记录Visual Studio中的大多数命令,包括文本编辑操作。 特性

记录并回放活动的文档操作和Visual Studio IDE命令 播放多次 使用宏资源管理器管理和持久化宏 为任何宏分配键盘绑定 宏记录为JavaScript文件,调用VS DTE api 宏编辑在Visual Studio与DTE智能感知 停止播放 示例宏


使用Visual Studio 2013 + 2015的宏

宏开源URL: https://github.com/Microsoft/VS-Macros

在MSDN博客上的公告:宏扩展:VS 2015支持和开源