I don’t remind where I originally got this Tip, but it’s proven to be very useful to save lots of time when you have very big solution and your projects are failing to build.

I am reporting it here as a note to myself because I really missed it when I had to install fresh copies of Visual Studio on new machines.

It’s basically a simple piece of macro you can add to the Visual Studio ‘EnvironmentEvents’ module:

  • Go to Tools -> Macro -> Macros IDE...
  • Look for MyMacros \ EnvironmentEvents in the project explorer tree.
  • Add this piece of code inside the module:
    ' A project failed to compile, so cancel the build and beep
    Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDone
       If Success = False Then
           DTE.ExecuteCommand("Build.Cancel")
           Beep()
           Threading.Thread.Sleep(250)
           Beep()
           Threading.Thread.Sleep(250)
           Beep()
           Threading.Thread.Sleep(250)
           Beep()
       End If
    End Sub
  • Enjoy.

I’m sad I cannot provide the original author with the right credits for it, if any have that info please let me know and I’ll update this post.

Related Content