
Automate Visual Studio #86
Chapter 12, Extending Visual Studio
|
383
HACK
remember that these operations could be performed by anything operating
against the object model.
Using the macro recording functionality of Visual Studio
[Hack #51] can be a great way to discover how to do some-
thing through the DTE (Development Tools Extensibility)
object. It isn’t always perfect, but it is sometimes easier than
trying to find the answer in the documentation.
MSDN includes a great reference to this object model. You can access the
MSDN documentation through Help
➝ Contents ➝ Visual Studio .NET ➝
Developing with Visual Studio ➝ Reference ➝ Automation and Extensibility
Reference or from MSDN Online at the following URL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/
html/vxoriExtensibilityReference.asp
The automation object model chart is particularly useful since it shows a
visual hyperlinked representation of the entire object model, and you can
drill down into the documentation for each class.
At the top of the object model is the DTE object. This object contains all of
the classes and collections that you will be working with to automate Visual
Studio. This is the object that your macro or add-in will reference and use.
Automate Documents
Possibly the most frequently used object in the DTE is the Document object.
Using the Document object, you can work with and manipulate any of