I'm trying to create an add-in for SSMS 2008 and/or 2008 R2 but I've run into a problem straight away.
I can get my add-in to work and on SSMS start-up get it to simply show a message box.
However, after downloading various code-samples, when trying to reference Microsoft.SqlServer.Management.UI.VSIntegration.ServiceCache I get a null reference exception:
Commands2 commands = (Commands2)ServiceCache.ExtensibilityModel.Commands;
I get this problem when using SSMS 2008 or SSMS 2008 R2. I'm working on Visual Studio 2010.
It's a bit frustrating because I'm keen to learn more about SSMS add-ins but can't seem to get past the few samples out there.
Any advice/tips appreciated.
Thanks
Karl, I don't know about your concrete problem here, but answering another question, I came across a bunch of articles and links on writing SSMS plug-ins - maybe one of them will be useful to you:
Some information can be found here:
ServiceCache is unreliable - from version to version it supports less and less and probable will go away at some point.
If you write SSMS Add-in, you can access internals by accessing VS ApplicationModel. Something like that:
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_addInInstance = (AddIn)addInInst;
_applicationObject = _addInInstance.DTE as DTE2;
_applicationObject has Commands and other interesting stuff.
Please note, that application argument of OnConnection has an incorrect object passed in. That's why you have to use this line to get the right object: _applicationObject = _addInInstance.DTE as DTE2;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With