Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update SQL addins to work in SSMS 2016?

Years ago I wrote an addin to do specific things I want in SSMS. I use it all the time and have gone through the pain of working out how to get it running again each time a new version of SQL server breaks the addin model.

I've now installed SSMS 2016 side by side with 2014, but despite a lot of searching I can find nothing about how to update addins for 2016 and I have not found a way to do it. My addin continues to work in 2014.

To be clear, my addin uses the common approach of a class that implements IDTExtensibility2 and IDTCommandTarget:

public partial class SSMSAddin : IDTExtensibility2, IDTCommandTarget 
{
    /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
    /// <param term='application'>Root object of the host application.</param>
    /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
    /// <param term='addInInst'>Object representing this Add-in.</param>
    /// <seealso class='IDTExtensibility2' />
    public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
    {
     .
     .
     .  
    }        
 .
 .
 .  
}

plus an XML configuration file (.addin) placed in one of the locations listed in the LookInFolders registry key such as

%APPDATA%\Microsoft\MSEnvShared\Addins

Evidently SSMS 2016 introduces changes such that existing addins will not work without some kind of rewrite. Also it seems it no longer uses the traditional .addin configuration file, as its registry entries no longer include the LookInFolders registry key which older versions use to find it. I read in the first of the two linked questions below that SSMS 2016 uses a new interface for addins, based on Visual Studio 2015 Shell, but I was unable to find any details of how to use the new interface or update legacy addin code.

Note: there are a couple of related SE questions Does the Poor Man's T-SQL formatting add-in for Management Studio 2012 work in Management Studio 2016? and SQL Server 2016 Plugins not working but they are different questions, people wanting to make third-party addins work. This question is about how to change my own addin to make it work in SSMS 2016.

like image 939
Reg Edit Avatar asked Oct 10 '16 03:10

Reg Edit


People also ask

How do I update SQL Server Management Studio 2016?

– Launch the SSMS and click on Tools from the menu, and finally check on check for updates as shown below. Click on Update as shown below. Also, ensure you check on “ Automatically check for updates for SQL Server Management Studio ” as shown below. In this way, you will be notified of future updates.

Does SSMS auto update?

Every time the SSMS is launched, the user will get an update notification and this is annoying for most users. The SQL Server Management Studio automatically bubbles and asks for updates. In many organizations, users do not have permission to install updates, and all the updates are managed via WSUS or ConfigMgr.


1 Answers

Indeed, .Addin are no longer supported. You need a VSIX project building into "C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Extensions[Your extension name]". There is not much information on how to extend SSMS 2016 but:

Here is some documentation for VSIX projects: https://docs.microsoft.com/fr-fr/visualstudio/extensibility/index

That forum helped me a lot: https://www.sqlservercentral.com/Forums/1802009/Developing-Extensions-for-SSMS-2016

You can't use Connect.cs anymore. The link between SSMS and your code now works with commands and packages as explained in the second link I posted.

Hope that helps

like image 191
Peter Poufsoufle Avatar answered Sep 18 '22 05:09

Peter Poufsoufle