I was a Visual Studio Macro junkie for years. I was always looking for a way to automate repetitious coding tasks. On of my favorite sets of macros was the code formatting macros that I used to tidy up the code.
I was disappointed to learn macros were not part of Visual Studio 2012. My disappointment faded once I saw how the extension model worked however. The new MEF based extensibility system simplified the process of creating and distributing Visual Studio plugins. Since it is so much easier to extend Visual studio the number of plugins (er, I mean extensions) skyrocketed. Last time I looked there were over 5,300 extensions available. I use CodeMaid for my formatting chores nowadays.
I decided to put my old formatting macros on GitHub. I know there are still companies that are using older versions of Visual Studio. Perhaps these macros will be helpful in some way.
Visual Studio 2010 Macros (Code Formatting)
Visual Studio 2010 Macros (Line Modifiers)
Private Sub OpenWindows(ByVal projItems As Collections.Generic.List(Of ProjectItem), _
ByVal includeExtensions As Generic.List(Of String), _
ByVal excludeExtensions As Generic.List(Of String))
‘ Opens all windows by looking at file extensions
‘ includeExtensions: Which extensions should be opened (Example, .xaml, .vb)
‘ excludeExtensions: Which extension to exclude. (Example .designer, .cs)
‘ the exclude list is handy when you don’t want to open the VS auto generated files
‘ note: do not include wildcards (example *.txt)
For Each candidate As ProjectItem In projItems
If candidate.IsOpen(ViewKind:=Constants.vsViewKindAny) Then
If EndsWith(candidate.Name, excludeExtensions) Then
If EndsWith(candidate.Name, includeExtensions) Then
Dim editWindow As Window = candidate.Open(Constants.vsViewKindTextView)