AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Sql server management studio 201512/11/2022 Now I want to get access to table and column information so I can select a column in SSMS and use this information to create the query. String values = t.Split(crlf, StringSplitOptions.RemoveEmptyEntries) Īnd then delete the existing selection and replace it with the list: Now just parse the selection and created a comma separated list to use as an IN predicate: Once I’ve got this reference I can easily get the currently selected text. The GetService method is described in not a lot of detail in the MS documentation. Note that each version of Visual Studio will include a different version of this namespace and each version maintains backward compatibility but includes additional functionality. The project will already have a reference to the containing namespaces: EnvDTE and EnvDTE80. This is pretty simple:ĭTE2 dte = (DTE2)ServiceProvider.GetService(typeof(DTE)) ĮxtSelection ts = (TextSelection) ĭTE2 is the top level automation object in the Visual Studio automation model. The first thing I need is to access the selected text in the SSMS query window. To keep things simple I’ll put all my code in this method even though that’s not good practice. This is the method that gets run when the menu item is selected. And this includes a MenuItemCallback method. If you’ve followed the tutorial above you’ll have a VSIX project which includes a Command class. This disables some of the debugging tools but this didn’t cause me any issues. You can workaround it by disabling the UI Debugging Tools for XAML. This is a bug that’s fixed in Visual Studio 2017 but I couldn’t find a fix for it in 2015. Message: An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationCore.dllĪdditional information: The visual tree has been changed during a 'VisualTreeChanged' event. The only issue I found was when I started debugging my project I got the following error: System.InvalidOperationException was unhandled Also note that I’ve only tested this with SSMS V17.9. Definitely follow his advice to use Visual Studio 2015 – I tried and failed with 2017. Just follow these instruction and you’re good to go. It’s a must read if you want to create an SSMS extension. I wouldn’t have got anywhere with this project without this brilliant article which covers the absolute basics of getting an extension running.
0 Comments
Read More
Leave a Reply. |