Search code examples
windowsvisual-studiossmsvsix

How can I get the version of SSMS from VSIX


I am developing an extention for SSMS using VSIX. In this extension I need to know which version of SSMS I am running on. What is the best way to get that?


Solution

  • I do it like this in my SSMS extension (for SSMS 16 and higher)

            var dte = GetServiceHelper(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
            if (dte == null) return new Version(130, 0, 0, 0);
            if (dte.RegistryRoot.Contains("14.0"))
            {
                return new Version(140, 0, 0, 0);
            }
            return new Version(130, 0, 0, 0);
    

    https://github.com/ErikEJ/SqlCeToolbox/blob/master/src/GUI/SSMSToolbox/Package/SqlCeToolboxPackage.cs#L67