直到我从Macro Explorer运行OnBuildBegin时,它才会在Visual Studio Macro中启动 [英] OnBuildBegin does not fire in Visual Studio Macro until I run it from Macro Explorer
本文介绍了直到我从Macro Explorer运行OnBuildBegin时,它才会在Visual Studio Macro中启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下Visual Studio宏:
I have the following Visual Studio Macro:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports MyMacros.EnvironmentEvents
Imports System.Diagnostics
Public Module Module1
Private WithEvents buildEvents As EnvDTE.BuildEvents = EnvironmentEvents.BuildEvents
Public Sub BuildEvents_OnBuildBegin() Handles buildEvents.OnBuildBegin
Dim projectItem As ProjectItem = DTE.Solution.FindProjectItem("T4MVCVB.tt")
projectItem.Save()
End Sub
End Module
我可以从Macro Explorer运行它,并且效果很好,在我从Macro Explorer双击它并运行之后,将在构建过程中调用事件处理程序.
I can run it from the Macro explorer, and it works great, and after i have double clicked it from the macro explorer and it has run, the eventhandler is invoked on build.
但是,如果我没有手动运行宏,则永远不会调用事件处理程序,也永远不会触发事件.
But if I haven't manually run the macro, the eventhandler is never invoked / event is never fired.
我在这里想念什么?
推荐答案
我将该部分直接放在自动生成区域之外的EnvironmentEvents模块中,现在每次都会触发.
I put the section in directly in the EnvironmentEvents Module outside the autogenerated region, and now it fires every time.
这篇关于直到我从Macro Explorer运行OnBuildBegin时,它才会在Visual Studio Macro中启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文