OnBuildBegin 在 Visual Studio 宏中不会触发,直到我从宏资源管理器运行它
我有以下 Visual Studio 宏:
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
我可以从宏资源管理器运行它,它工作得很好,在我从宏资源管理器中双击它并运行后,在构建时调用事件处理程序。
但是,如果我没有手动运行宏,则永远不会调用事件处理程序/永远不会触发事件。
我在这里缺少什么?
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
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.
What am i missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将该部分直接放入自动生成区域之外的环境事件模块中,现在它每次都会触发。
I put the section in directly in the EnvironmentEvents Module outside the autogenerated region, and now it fires every time.