views:

97

answers:

3

I want to count how many 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.

+1  A: 

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.

Oded
A: 

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
JaredPar
A: 

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
AareP