Is there any way to trigger some macro after build in visual studio
I want to count how many 开发者_Go百科times i built on VS.NET . I have a plan. If i run svn commit when i build to project, i would have build count on revision number :)
I didn't write any macro which can execute a command. And i don't know visual studio is allowing to prebuild event for this kind of request.
You can use pre/post build events.
In your project properties, go to the Build events
tab - there is space for both pre build and post build commands.
See this blog post on how incrementing build numbers can be done.
Yes this is possible.
- Open up the Macros IDE
- Open the file called environmentEvents
This file has the various DTE event objects declared and you can easily add a handler like so.
Private Sub PostBuild() Handles BuildEvents.OnBuildDone
' Your code here
End Sub
Also can use:
Dim WithEvents myTimer As Timers.Timer
Sub CustomBuild()
DTE.ExecuteCommand("Build.BuildAll")
myTimer = New Timers.Timer
myTimer.Interval = 0.05
myTimer.Start()
End Sub
Sub myTimer_Elapsed(ByVal ee As Object, ByVal dd As Timers.ElapsedEventArgs) Handles myTimer.Elapsed
If DTE.Solution.SolutionBuild.BuildState <> vsBuildState.vsBuildStateInProgress Then
myTimer.Stop()
End If
If DTE.Solution.SolutionBuild.BuildState <> vsBuildState.vsBuildStateInProgress And DTE.Solution.SolutionBuild.LastBuildInfo <> 1 Then
... build was successful ...
End If
End Sub
精彩评论