Skip to content

Instantly share code, notes, and snippets.

@chilversc
Created February 27, 2013 13:08
Show Gist options
  • Select an option

  • Save chilversc/5047785 to your computer and use it in GitHub Desktop.

Select an option

Save chilversc/5047785 to your computer and use it in GitHub Desktop.
Couple of VS macros, change insert tabs/spaces, removing trailing spaces and attach debugger to IIS Express
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module Module1
Sub UseTabs()
DTE.Properties("TextEditor", "AllLanguages").Item("InsertTabs").Value = True
End Sub
Sub UseSpaces()
DTE.Properties("TextEditor", "AllLanguages").Item("InsertTabs").Value = False
End Sub
Sub RemoveTrailingSpace()
Dim find As Find2 = DTE.Find
Dim options = _
vsFindOptions.vsFindOptionsMatchInHiddenText Or _
vsFindOptions.vsFindOptionsFromStart Or _
vsFindOptions.vsFindOptionsRegularExpression
find.FindReplace( _
Action:=vsFindAction.vsFindActionReplaceAll, _
FindWhat:=":b+$", _
ReplaceWith:="", _
vsFindOptionsValue:=options, _
Target:=vsFindTarget.vsFindTargetCurrentDocument, _
ResultsLocation:=vsFindResultsLocation.vsFindResultsNone)
End Sub
Sub AttachToIisExpress()
Try
Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
Dim dbgeng(1) As EnvDTE80.Engine
dbgeng(0) = trans.Engines.Item("Managed (v4.0)")
Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, ".").Item("iisexpress.exe")
proc2.Attach2(dbgeng)
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment