Wednesday, May 5, 2010

Stopping a run away Visual Studio build

To stop a build in progress use ctrl + break (as found on Steven Harman's blog)

Alternatively, add a Macro (Visual Studio -> Tools -> Macros -> Macro IDE... or ALT+F11) that will stop the solution build when a project fails to build. This can save a lot of time when all the subsequent projects will fail.

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
            ' Stop the build when the first project fails to build.
            DTE.ExecuteCommand("Build.Cancel")
        End If

    End Sub

See also: