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

痞子三分冷 提交于 2019-12-03 07:59:27

问题


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?


回答1:


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




回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!