Is there any way to log the number of builds done during a development day in Visual Studio, or anywhere we can hook into something to get at the metadata?
I'm curious how many times on average I build/day * how long it takes per build...
Any thoughts?
UPDATE: sorry for the lack of details...and this exercise is purely academic
With a solution that has 14 different projects (1 is a web site). I am constantly building the entire solution (Ctrl + Shift + B). It would be interesting to find out not only the number of times I build during the day, but how much time is spent waiting for a build to complete...
The optimal solution would be one that doesn't require a change to the solution's projects itself. (pre/post build events) I don't want to have to add/undo changes before/after check-ins.
(The nant/other solution is sounding like the answer, I guess I could map that to a shortcut key and not have to leave VS to do the build)
Any other suggestions?
Use your macro explorer to create a new macro. Open the new macro and edit the EnvironmentEvents Module (you can leave the other module empty). You could use a database instead of a file.
Private BuildStopWatch As System.Diagnostics.Stopwatch = New System.Diagnostics.Stopwatch()
Private Sub BuildEvents_OnBuildBegin(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildBegin
BuildStopWatch.Reset()
BuildStopWatch.Start()
End Sub
Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
BuildStopWatch.Stop()
DTE.ToolWindows.OutputWindow.ActivePane.OutputString("Build succeed in " & BuildStopWatch.Elapsed.TotalSeconds & " seconds.")
Dim fileName As String = "D:\BuildTimes.txt"
Try
Dim streamWriter As StreamWriter
If File.Exists(fileName) Then
streamWriter = File.AppendText(fileName)
Else
streamWriter = File.CreateText(fileName)
End If
streamWriter.WriteLine(DateTime.Now.ToString() & " " & "Build Time:" & BuildStopWatch.Elapsed.TotalSeconds)
streamWriter.Close()
streamWriter.Dispose()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub