Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
494 views
in Technique[技术] by (71.8m points)

sql server - How to Create an Extension for SSMS 2019 (v18)

SQL Server Management Studio 18 RC1 became available March 28, 2018

This question has already been asked for SSMS 17, but there are slight variations when authoring extensions for different releases of SQL Server Management Studio.

What are the steps to getting a Hello World application up an running in SSMS 2019?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here are the complete steps, adapted from Stefan Timovski's article on How to Create SQL Server Management Studio 18 (SSMS) Extension

  1. Install Visual Studio 2017 with Extensions Toolkit

    If you're not sure you have the extensions toolkit, you can open the Visual Studio Installer and modify your current install to make sure you have extensions installed

    Visual Studio Installer
    Visual Studio Extension Development

  2. Create New Extension Project

    Go to File New Project (Ctrl + Shift + N)

    File > New > Project

    Choose Extensibility > VIX Project

    Extensibility > VSIX Project

    If you don't have these options, go make sure you did step 1

  3. Add a New Command Item

    Add a new item (Ctrl + Shift + A)

    Add New Item

    Select Extensibility and just for demo purposes grab a custom command

    Extensibility > Custom Command

  4. Debug in Visual Studio

    The command file will add a menu item to Tools > Invoke Command1. If you hit debug, Visual Studio will launch a Debuggable instance, fully loaded with your current extension. Hit play or hit F5

    The first time may take a minute to boot-up, but it should go faster thereafter

    Launch Debug

    The click event handled in located in Command1.cs > Execute, and you can add breakpoints.

    Debugger Breakpoint

    Here's the working message box

    Callback

  5. Get filepath for SSMS

    The default installation path for SSMS 18 should be:

    C:Program Files (x86)Microsoft SQL Server Management Studio 18Common7IDESsms.exe
    

    If it's not there, to identify the startup location of any app, you can Shift + Right Clicking on the app icon and select "Open file location"

    SSMS Location

  6. Set Launch to SSMS

    Open up the project properties in VS (Alt + Enter)

    Project Properties

    Go to Debug > Start External Program and paste in the path

    Debug > Start External Program

    Remove the command line args as they're no longer applicable to SSMS

  7. Set Deploy VSIX to SSMS

    The "Extensions" subdirectory should be in the same directory as SSMS. Also, add an extra folder with your project name like this

    C:Program Files (x86)Microsoft SQL Server Management Studio 18Common7IDEExtensionsVSIXProject1
    

    Go to VSIX > and select "Copy VSIX content to the following location"

    VSIX Copy

  8. Set Permissions

    Lastly, in order to programmatically invoke any apps on C Drive, you'll need admin privileges, so you need to open Visual Studio in Admin Mode. You can do that by right clicking on the application like this

    Run As Admin

  9. Hit Run & Debug

    Presto! Blamo! Your extension should now be running SSMS

    SSMS Debugger

Further Reading

Historically, each extension needed to be whitelisted, but according to the release notes for SSMS 18, one big change (for the better) is

Package IDs no longer needed to develop SSMS Extensions
In the past, SSMS was selectively loading only well-known packages, thus requiring developers to register their own package. This is no longer the case.

Since SSMS 18 uses the Visual Studio 2017 Isolated Shell, many of the extension developer documentation is available under the Visual Studio Extension Docs


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...