原文 How to write own add-in for SSMS 2012 (Final release version)

Reading internet forums I have noticed that some developers want to experiment and write own add-ins for Sql Server Management Studio (SSMS). As far as there are enough samples for SSMS 2008, I will focus here onimplementation of add-in for SSMS 2012.

Microsoft does not support development of plug-ins for SSMS officially and for good reason: they simply do not want to support backward compatibility of add-in API between different SSMS versions. There were already at least 2 "breaking releases", where developers had to seriously update plug-ins to make them working. It was update from SSMS 2005 to SSMS 2008 and from SSMS 2008 to SSMS 2012, not to mention "small jump" from SSMS 2008 to SSMS 2008R2. So, probably it is "ok" that they keep themselves free from obligations to keep any compatibility, because they want to improve SSMS as quickly as it gets and are doing it for past 8 years :).

In current release there were a lot of significant changes: SSMS is getting closer to standard DTE environment of Visual Studio - and that is why it has completely new way of detection of installed add-ins (will be described below).

Why am I writing this ? It is just a warning: if you are going to implement some "nice tool" to use internally in your company, you have to take into consideration that most probably it will stop working after next update to SSMS 2015(?) and you will have to spend some weeks before it will start working again. I just want to encourage you: if you miss some feature in SSMS that you think will also help other developers to do their T-SQL work more efficient - just write me and I will do my best to include it into the next release of SSMSBoost.

So, now no more words: download C# project with sample code of working plug-in. Unzip it and compile using Visual Studio 2010. It also compiles under C# Express Edition of Visual Studio 2010.

To compile the project you will need to update the reference to SqlPackageBase.dll
it is installed along with SQL Server Management Studio and is located under following path:
%PROGRAMFILES%\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SqlPackageBase.dll
(C:\Program Files\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SqlPackageBase.dll)

Sample includes following steps:

  • Registration of add-in within SSMS environment
  • Connecting to SSMS environment
  • Finding Main menu, Finding "Tools" menu item and adding own command there
  • Processing of command state (enabled/disabled)
  • Command execution
  • Accessing _current_ SQL Editor window and pasting some text into it

After you have compiled the sample code you have to let SSMS 2012 know that you want it to load your add-in.(This is breaking change from SSMS 2008 to SSMS 2012)
SSMSAddin.addin file provides information about location of add-in dll. So edit SSMSAddin.addin file  and update path mentioned by Assembly element to location where it resides (probably your bin\debug folder).

Next step - you have to put SSMSAddin.addin to one of "known" folders, where SSMS looks for .addin files. These folders are listed under this registry key:

HKCU\Software\Microsoft\SQL Server Management Studio\11.0_Config\AutomationOptions\LookInFolders

For example these folders are "good":
Putting SSMSAddin.addin into %PROGRAMDATA%\Application Data\Microsoft\MSEnvShared\Addins\ 
(C:\ProgramData\Application Data\Microsoft\MSEnvShared\Addins\)
Will install add-in for all users on the machine.

Putting SSMSAddin.addin into %APPDATA%\Microsoft\MSEnvShared\Addins\ 
(C:\Users\UserName\AppData\Roaming\Microsoft\MSEnvShared\Addins\) 
will install for specific user only.

Pay attention that MSEnvShared\Addins\ folder might not exist and you will have to create it yourself.

That's all. Run SQL Server Management Studio and look into "Tools" menu. You should notice new command there. Execute it and you will get some text output into currently opened SQL Editor window (pay attention - at least one SQL Editor window must be open).

This plug-in works for all editions of SSMS 2012, including SQL Server Management Studio Express edition, and both 32 and 64 bit builds. 
Andrei Rantsevich
Written:May, 2012
Last update: August, 2012 

How to write own add-in for SSMS 2012 (Final release version)的更多相关文章

  1. The type 'Expression<>' is defined in an assembly that is not referenced.You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    在我将一个.net framework 4.0+mvc4+ef5的项目,升级到.net framework 4.6.1+mvc5+ef6之后,解决了所有的升级带来的问题,唯独在razor的cshtml ...

  2. IMS Global Learning Tools Interoperability™ Implementation Guide

    Final Version 1.1 Date Issued:            13 March 2012 Latest version:         http://www.imsglobal ...

  3. maven官方教程

    What is Maven? At first glance Maven can appear to be many things, but in a nutshell Maven is an att ...

  4. wp8.1 sdk preview 预览版

    http://pan.baidu.com/s/1hqyusja?qq-pf-to=pcqq.c2c#dir/path=%2FWPSDK%208.1%20DevPreview%20Installerwp ...

  5. YASM User Manual

    This document is the user manual for the Yasm assembler. It is intended as both an introduction and ...

  6. 用SSMS连接Azure Sql Database 与连接本地库的一些操作区别

    背景 我们知道Azure Sql Database 可以降低运维成本.是一种Pass模式,有资源弹性设置,可以自由调整资源自动对应不同业务高峰(当然也可以降低费用成本),也方便项目后期的资源扩展,以及 ...

  7. SQL Server 扩展事件(Extented Events)从入门到进阶(2)——在GUI中创建基础扩展事件

    本文属于 SQL Server 扩展事件(Extented Events)从入门到进阶 系列 第一篇文章中提到了如何在Profiler中创建跟踪(trace),并以服务器端(server-side)跟 ...

  8. Microsoft SQL Server Trace Flags

    Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful w ...

  9. SQL Server Extended Events 进阶 2:使用UI创建基本的事件会话

    第一阶中我们描述了如何在Profiler中自定义一个Trace,并且让它运行在服务器端来创建一个Trace文件.然后我们通过Jonathan Kehayias的 sp_SQLskills_Conver ...

随机推荐

  1. 初识 Cloudera Impala

    Impala是Cloudera公司主导开发的新型查询系统,它提供SQL语义,能查询存储在Hadoop的HDFS和HBase中的PB级大数据.已有的Hive系统尽管也提供了SQL语义,但因为Hive底层 ...

  2. jsRender模板引擎

    jsRender模板引擎 上一篇最后提到了模板,并尝试自己编写一个最简单版本:有些朋友可能用过 jqtmpl,这是一个基于jquery的模板引擎,不过它已经不再更新了,而且据说渲染速度比较慢.这里介绍 ...

  3. SQLServer 2012异常问题(二)--由安装介质引发性能问题

    原文:SQLServer 2012异常问题(二)--由安装介质引发性能问题 问题描述:生产环境一个数据库从SQLSERVER 2008 R2升级到SQLSERVER 2012 ,同时更换硬件,但迁移后 ...

  4. cocos2d 消除类游戏简单的算法 (一)

    1. 游戏视频演示 2.三消游戏我的理解 上面视频中的游戏.我做了2个星期时间,仅仅能算个简单Demo,还有bug.特效也差点儿没有.感觉三消游戏主要靠磨.越磨越精品. 市场上三消游戏已经超级多了.主 ...

  5. Java并发编程:线程池的使用(转)

    Java并发编程:线程池的使用 在前面的文章中,我们使用线程的时候就去创建一个线程,这样实现起来非常简便,但是就会有一个问题: 如果并发的线程数量很多,并且每个线程都是执行一个时间很短的任务就结束了, ...

  6. vmware 新机克隆

    选li72 右键点击------管理-----克隆 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbGlsaTcy/font/5a6L5L2T/fontsi ...

  7. uva 1534 - Taekwondo(dp+馋)

    题目连接:uva 1534 - Taekwondo 题目大意:有两组什么东西,题目背景有点忘记了,就是给出两组数,两组个数分别为n,m,要求找出min(n,m)对数.每一个数最多最多选一次,使得这mi ...

  8. Java批处理操作

    批量,可以大大提高众多增加.删除.变化的步伐,它是有一个非常大的数据处理效率大收益. 的"连接池"相似.事实上就是先将多次操作(增删改)打包.然后再一次发送运行 主要用到两个方法: ...

  9. android 性能測试iozone篇

    一:简单介绍 iozone是一个文件系统的benchmark工具, 用于測试不同的操作系统中文件系统的读写性能, 能够測试下面13种模式 0=write/rewrite 1=read/re-read ...

  10. 2机器学习实践笔记(k-最近邻)

    1:算法是简单的叙述说明 由于训练数据样本和标签,为测试数据的示例,从最近的距离k训练样本,此k练样本中所属类别最多的类即为该測试样本的预測标签. 简称kNN.通常k是不大于20的整数,这里的距离通常 ...