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?