SSMS ecosystem

Debugging an SSMS addin

This is a step-by-step guide to debugging an addin to SSMS from Visual Studio.

Step 1: Set as StartUp Project

You should set your addin project as Visual Studios StartUp project. This means that when you start the Visual Studio debugger start this project by default.

Step 2: Configure project debug start action.

In you addin project's properties find the Debug tab. Set the start action to "Start external program:" and then enter the path to your SSMS exe.

In 2012 this is typically: C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\ssms.exe

In 2008r2 this is typically: C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe

Step 3: Disable PInvokeStackImbalance exceptions

SSMS raises lots of PInvokeStackImbalance exceptions which you want to ignore. Open the Debug Exceptions window with Ctrl+Alt+D and use the Find command to locate PInvokeStackImbalance. Once you have found it, untick the Thrown checkbox.

Step 4: Set a break point

Set a break point on the first line of your OnLoad function in the class that implements ISsmsAddin. Now

Now press F5 to start debugging.

Didn't find what you were looking for?