I have some Visual Studio Macros created in visual studio which run from the macro explorer and/or keyboard shortcuts. I would like to run these automatically on pre/post build events but see no option to do so in the project properties. Can anyone tell me if this is possible and, if so, how?
我在Visual Studio中创建了一些从宏浏览器和/或键盘快捷方式运行的Visual Studio宏。我想在前/后构建事件上自动运行这些,但在项目属性中看不到这样做的选项。任何人都可以告诉我这是否可能,如果是的话,怎么样?
2 个解决方案
#1
In your macro there are 4 build events you can hook into:
在您的宏中,您可以连接4个构建事件:
-
OnBuildBegin -- Will fire when any build operation is fired from the IDE. It fires only once for a full solution or multiproject build operation.
OnBuildBegin - 从IDE触发任何构建操作时将触发。它仅针对完整解决方案或多项目构建操作触发一次。
-
OnBuildDone -- Will fire when a build operation completes. This event fires only once for a full solution or multiproject build operation.
OnBuildDone - 在构建操作完成时将触发。对于完整解决方案或多项目构建操作,此事件仅触发一次。
-
OnBuildProjConfigBegin -- Will fire when a project build begins. This event is used to catch each project build event within a solution or multiproject build operation.
OnBuildProjConfigBegin - 项目构建开始时将触发。此事件用于捕获解决方案或多项目构建操作中的每个项目构建事件。
-
OnBuildProjConfigDone -- Will fire when a project build completes. This event is used to catch the completion of each project build within a solution or multiproject build operation.
OnBuildProjConfigDone - 项目构建完成时将触发。此事件用于捕获解决方案或多项目构建操作中每个项目构建的完成。
Common Environment Object Model Events
公共环境对象模型事件
#2
I don't belive it's possible. That said, you can quickly create custom MSBuild tasks to do the job of the macros.
我不相信它是可能的。也就是说,您可以快速创建自定义MSBuild任务来完成宏的工作。
#1
In your macro there are 4 build events you can hook into:
在您的宏中,您可以连接4个构建事件:
-
OnBuildBegin -- Will fire when any build operation is fired from the IDE. It fires only once for a full solution or multiproject build operation.
OnBuildBegin - 从IDE触发任何构建操作时将触发。它仅针对完整解决方案或多项目构建操作触发一次。
-
OnBuildDone -- Will fire when a build operation completes. This event fires only once for a full solution or multiproject build operation.
OnBuildDone - 在构建操作完成时将触发。对于完整解决方案或多项目构建操作,此事件仅触发一次。
-
OnBuildProjConfigBegin -- Will fire when a project build begins. This event is used to catch each project build event within a solution or multiproject build operation.
OnBuildProjConfigBegin - 项目构建开始时将触发。此事件用于捕获解决方案或多项目构建操作中的每个项目构建事件。
-
OnBuildProjConfigDone -- Will fire when a project build completes. This event is used to catch the completion of each project build within a solution or multiproject build operation.
OnBuildProjConfigDone - 项目构建完成时将触发。此事件用于捕获解决方案或多项目构建操作中每个项目构建的完成。
Common Environment Object Model Events
公共环境对象模型事件
#2
I don't belive it's possible. That said, you can quickly create custom MSBuild tasks to do the job of the macros.
我不相信它是可能的。也就是说,您可以快速创建自定义MSBuild任务来完成宏的工作。