如何为SSMS 2019(v18)创建扩展 [英] How to Create an Extension for SSMS 2019 (v18)

查看:272
本文介绍了如何为SSMS 2019(v18)创建扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

对于SSMS 17,已经针对该问题提出了此问题,但是在编写不同版本的SQL的扩展时会有一些细微的差异服务器管理Studio.

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.

如何使Hello World应用程序在SSMS 2019中运行?

推荐答案

以下是完整的步骤,改编自Stefan Timovski在

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

  1. 使用扩展工具包安装 Visual Studio 2017 >

  1. Install Visual Studio 2017 with Extensions Toolkit

如果不确定是否具有扩展工具包,则可以打开Visual Studio安装程序并修改当前安装以确保已安装扩展.

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


创建新的扩展项目

转到文件新项目( Ctrl + Shift + N )

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

选择可扩展性> VIX项目

Choose Extensibility > VIX Project

如果没有这些选项,请确保已执行步骤1

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

添加新命令项

添加新项( Ctrl + Shift + A )

Add a new item (Ctrl + Shift + A)

选择可扩展性,仅出于演示目的,抓住自定义命令

Select Extensibility and just for demo purposes grab a custom command

在Visual Studio中调试

命令文件将在工具">调用 Command1 "中添加一个菜单项.如果您点击调试,Visual Studio将启动一个Debuggable实例,该实例已满载您当前的扩展名.点击播放或点击 F5

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

Command1 .cs> Execute中处理的单击事件,您可以添加断点.

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

这是工作消息框

获取SSMS的文件路径

SSMS 18的默认安装路径应为:

The default installation path for SSMS 18 should be:

C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe

如果不存在,请使用 Shift +右键单击该应用程序图标,然后选择打开文件位置",以标识任何应用程序的启动位置.

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

在VS中打开项目属性( Alt + Enter )

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

转到调试> 启动外部程序并粘贴路径

删除命令行参数,因为它们不再适用于SSMS

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

设置将VSIX部署到SSMS

扩展名"子目录应与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 18\Common7\IDE\Extensions\VSIXProject1

转到 VSIX >,然后选择"将VSIX内容复制到以下位置"

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

设置权限

最后,为了以编程方式调用C Drive上的任何应用程序,您将需要管理员权限,因此需要在管理员模式"下打开Visual Studio.您可以通过右键单击像这样的应用程序来做到这一点

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

命中运行&调试

Presto!布拉莫!您的扩展程序现在应该正在运行SSMS

Presto! Blamo! Your extension should now be running SSMS

进一步阅读

从历史上看,每个扩展都需要列入白名单,但是根据

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

开发SSMS扩展不再需要软件包ID
过去,SSMS仅选择性地加载知名软件包,因此要求开发人员注册自己的软件包.情况不再如此.

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.

由于SSMS 18使用 Visual Studio 2017隔离外壳,因此许多扩展开发人员文档位于

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

这篇关于如何为SSMS 2019(v18)创建扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆