Saturday, July 22, 2006

VS.Net... Cancel A Failed Build

I only recently came across this Visual Studio Hack by Michael Wood to fix one of the single most irritating problems with both Visual Studio 2003 and Visual Studio 2005.

[Rant] How Microsoft continue to screw this up is beyond me - do they ever actually use their own products outside of their single assembly demos showing drag/dropping of connections onto forms? Why on earth when you have a referenced project failing to compile would you want to continue trying to compile everything underneath, ending up with screens of irrelevant errors and a Task List that is completely useless? [/Rant]

This macro is an absolute must have in your IDE... just add to the MyMacros -> EnvironmentEvents module (you may already have the WithEvents declaration):
<system.contextstaticattribute()> _
Public WithEvents BuildEvents As EnvDTE.BuildEvents

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
'The build failed...cancel any further builds.
DTE.ExecuteCommand("Build.Cancel")
End If

End Sub

2 Comments:

At July 22, 2006 5:54 pm, Anonymous Anonymous said...

Glad you liked it!

 
At August 28, 2009 5:09 pm, Blogger Unknown said...

Very cool, Thanks!

 

Post a Comment

<< Home