How to create extension for SQL Server Management Studio 17 in C# in VS2017?
Asked Answered
C

2

4

I followed simple Hello World sample from Create your first extension: Hello World example from the Microsoft Docs to build an extension for SSMS 2017

  1. Created VSIX project from Extensibility project template

  2. Changed "Start External Program" in Project > Properties > Debug to
    C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe

  3. Add -S (localdb)\MSSQLLocalDB -d sampleDB -E in command line arguments as
    it requires servername/database be specified to run SSMS.exe.

  4. Add Custom command using Add new item
  5. Run the project

If step #2 & #3 is not performed, it works fine with Visual Studio, however nothing happens with SSMS, though it launches SSMS.

DId I missing something or is there any restriction for creating add-in for SSMS?

Chartres answered 11/11, 2017 at 16:12 Comment(4)
Are you sure your project is registered with the proper registry key? For example with SSMS 14, it was HKCU\Software\Microsoft\SQL Server Management Studio\12xxx not HKCU\Software\Microsoft\VisualStudioMegavolt
I am debugging from VS itself, where should I look for registry?Chartres
Did you solve this problem?Prudie
@PrzemysławNiedziela Nope, didn't find doc for current versionChartres
M
3

You got the first bit right, but there are a couple more steps to do before you’re set:

  1. You need to tell Visual studio to copy the extension (on build) to the SSMS extensions folder so that SSMS can load it while starting up.
  2. You need to tell SSMS to skip its internal extension validation because it won’t load any extensions that are not white listed by the SSMS team.

I explained this process in detail in an article I created at CodeProject. You can find the full tutorial at the following link: https://www.codeproject.com/Articles/1243356/Create-Your-Own-SQL-Server-Management-Studio-SSMS

Mantel answered 12/5, 2018 at 13:15 Comment(4)
You need to add critical data from your article here. Otherwise, this post will become useless when the link rots.Impetrate
@ivan_pozdeev, in defense, most of the article covers what OP put in the body of the post. The inlined advice here actually covers the missing pieces, so this does seek to directly address the question w/o external resources.Mellott
@Mellott Maybe, but the current formulation suggests exactly the opposite.Impetrate
@ivan_pozdeev, inlined the majors steps in this question directed at installing extensions for SSMS 18Mellott
C
2

First, you need to declare SSMS support in your source.extension.vsixmanifest file:

  <Installation>
    <InstallationTarget Id="ssms" Version="[14.0, 14.0]" />
  </Installation>

Then I don't think VS can automatically install your extension for SSMS. So, run the .vsix file manually.

Clotildecloture answered 12/11, 2017 at 6:31 Comment(1)
I have added Installation Target & run vsix, however, it still not working.Chartres

© 2022 - 2024 — McMap. All rights reserved.