My .NET solution contains over 150 individual files and I want to write an IDE macro that will set a breakpoint on every line of code that starts with "Debug.Write".
Anybody got any idea how to do this?
Printable View
My .NET solution contains over 150 individual files and I want to write an IDE macro that will set a breakpoint on every line of code that starts with "Debug.Write".
Anybody got any idea how to do this?
Nobody got any ideas? This is what I've got so far, but the condition on the While loop always returns True - I can't find a way of stopping searching when I've reached the end of the file.
VB Code:
Public Sub macBREAKPOINT() Dim proj As Project = DTE.Solution.Projects.Item(1) Dim projitem As ProjectItem Dim blnOK As Boolean = False Dim i As Integer Dim objFind As Find For Each projitem In proj.ProjectItems If Right(projitem.Name, 3) = ".vb" Then Debug.Write(projitem.Name & vbCrLf) DTE.ItemOperations.OpenFile(projitem.Name) objFind.FindWhat = "Debug.Write" objFind.Target = vsFindTarget.vsFindTargetCurrentDocument objFind.MatchCase = False objFind.MatchWholeWord = False objFind.Backwards = False objFind.MatchInHiddenText = True objFind.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral objFind.Action = vsFindAction.vsFindActionFindAll DTE.ActiveDocument.Selection.StartOfDocument() While objFind.Execute() = vsFindResult.vsFindResultFound DTE.ExecuteCommand("Debug.ToggleBreakpoint") DTE.ActiveDocument.Selection.EndOfLine() End While DTE.ActiveWindow.Close(vsSaveChanges.vsSaveChangesNo) End If Next End Sub