您如何导出和导入Visual Studio宏?

问题描述:

我想导出一些我定义的宏,并能够将它们导入具有我定义的相同模块/命名结构的Visual Studio的另一个全新安装中.

I would like to export some macros that I have defined and be able to import them into another clean install of Visual Studio with the same module/naming structure that I have defined.

我有一些执行宏的菜单命令自定义-因此,要在Visual Studio的另一个安装中工作,它需要可用的相同宏.

I have some menu command customizations that execute my macros - so to work in another install of Visual Studio, it needs the same macros available.

我想避免手动创建宏并复制/粘贴我的宏代码的手动步骤.

I would like to avoid a manual step of having to create the macro manually and copy/paste my macro code.

这可能吗?通过菜单 Tools -> Import and Export Settings 导入/导出似乎不是'macros'可用的选项.

Is this possible? It doesn't seem like 'macros' is an available option to import/export through menu Tools -> Import and Export Settings.

工具-> Macros-> Macros IDE ...(或Alt + F11)

Tools->Macros->Macros IDE... (or Alt+F11)

导出:展开宏,直到找到要导出的模块,右键单击它,选择导出模块名称...",选择一个文件,然后保存.

Export: Expand your macros until you find the module you want to export, right-click it, choose Export ModuleName..., select a file, and Save.

导入:选择"MyMacros"或任何其他内容,右键单击它,然后选择添加"->添加现有项...",选择刚刚创建的文件,然后添加.

Import: Select "MyMacros" or any other, right-click it, and choose Add->Add Existing Item... Select the file you just created, and Add.