问题
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
Created VSIX project from Extensibility project template
Changed "Start External Program" in Project > Properties > Debug to
C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe
Add
-S (localdb)\MSSQLLocalDB -d sampleDB -E
in command line arguments as
it requires servername/database be specified to run SSMS.exe.- Add Custom command using Add new item
- 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?
回答1:
You got the first bit right, but there are a couple more steps to do before you’re set:
- 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.
- 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
回答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.
来源:https://stackoverflow.com/questions/47240020/how-to-create-extension-for-sql-server-management-studio-17-in-c-sharp-in-vs2017