Professional Visual Studio Extensibility by Keyvan Nayyeri
Yet another book that I bought cheaply on Amazon. Slightly out of date as it deals with Visual Studio 2008, and it has a focus on extending Visual Studio using add-ins and macros which are not supported in the Visual Studio 2012. However, it does have a chapter on extensibility using Visual Studio packages, and the material on interacting with the Visual Studio object model is also still very relevant.
At work I’ve written extensions that interact with Visual Studio’s extension model, and this book gives a very good overview of the things that you need to understand to work effectively. From a historical point of view the book also offers the information that helps you understand why things are done in a particular way.
There are chapters on the automation model, the anatomy of an add-in (covering the COM interfaces that it needs to implement), and an introduction to solutions, projects and project items. This latter chapter helps you navigate to the various interesting documents that are contained within the project structure, and then the following chapters describe the object model around documents – with these you can navigate their structure down to the level of methods and then manipulate the body of the method as text. There are some good examples demonstrating the types of things you can do. The next chapter covers the build process, allowing your add-in to trigger and take part in the build process for a solution.
Later chapters cover debugging, building, deploying and localising an add-in, and the book finishes with chapters on extending the debugger, and the advantages of using the more modern package instead of the older add-in (as a package gives more access to Visual Studio). The last chapters cover project templates (very interesting), MSBuild (a slightly out-dated introduction) and macros (now irrelevant).
Given how little information there appears on be out there on the internet regarding Visual Studio Extensibility this is a very good introductory book that covers the area, with good examples, though obviously given the breadth the depth is sometimes a little shallow. Well worth a read though!