A SQL Server Management Studio (SSMS) add-in requires quite a bit of boilerplate code just to get started. Since official documentation is scarce, knowing which events to hook, functions to call, and incantations to recite requires a considerable amount of poking and prodding of the black box that is SSMS (and its supporting libraries). Thankfully, much of this has been done and written about! Rather than restate what has already been masterfully said, here are a few very helpful resources for getting started developing an add-in:
- Building a SSMS Add-in; The Agony and Ecstasy with Mark Pryce-Maher (video)
- Mark steps through the process of building a new SSMS add-in from scratch, describing gotchas you’ll run into along the way. The code he ends up with is available on CodePlex and serves as a good baseline for new development.
- A four-part series at SQL Judo: Building a Custom Add-In / Extension (Part 2 - Deploying, Part 3 - Debugging, Part 4 - Exploring VSPackage)
- A step-by-step walkthrough with screenshots. Russ also takes a crack at the VSPackage format, which may replace the AddIn format in SSMS like it did in Visual Studio.
- The Black Art of Writing a SQL Server Management Studio 2005 Add-In
- Written for SSMS 2005, but presents the still-relevant basics well. You can skip the section about add-in registration and the Windows registry unless you are targeting Management Studio 2005.
More example code can be found by searching CodePlex, GitHub, etc. It’s worth noting that most of the code out there was written in Visual Studio 2010 (or earlier) using the old Visual Studio setup project format, and therefore may error when opening in newer IDEs. This is because Microsoft ended support for *.vdproj projects with VS2012+. Although they have released an extension to support in in VS2013, it's clear that it is no longer being maintained and the WiX Toolset is the official recommendation moving forward. We’ll explore installing an add-in using the WiX Toolset in a future post.