vsx

How can I perform “Go To Definition” programmatically in Visual Studio?

非 Y 不嫁゛ 提交于 2019-12-06 00:26:46
问题 Given a string that represents a specific class/field/property (eg MyNameSpace.MyClass or System.String.Length ), how can I programmatically cause Visual Studio to go to that class/field/property (ie, make Visual Studio do the same thing that would happen if I was to type in the reference in the code editor and then hit F12)? 回答1: You probably need to do the following. Get the global IVsObjectManager2 interface (implemented by the SVsObjectManager object) Call IVsObjectManager2.FindLibrary to

Visual Studio CommandBar “Names”

て烟熏妆下的殇ゞ 提交于 2019-12-05 23:29:27
问题 In Visual Studio 2010, the only option you can create is a commandbar under "Tools" on the "MenuBar". In some cases, I would want to know how to place the command bar on the standard bar, or be found when I right-click a project file. Example: Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject. CommandBars)["MenuBar"]; By default it shows "MenuBar" and I am certain there is others, such as "Standard". However I

What goes in the “Non-Public members” node in Visual Studio's Watch window?

泪湿孤枕 提交于 2019-12-05 22:01:05
I assumed that all Non-Public (ie, private, protected, internal, and internal protected) members of C# objects go under " Non-Public Members " when I look at objects in Visual Studio's Watch Window. But then, I noticed an anamoly with this code: class HashDerived : System.Security.Cryptography.HashAlgorithm { ... } HashAlgorithm hash1 = new HashDerived(); HashAlgorithm hash2 = new System.Security.Cryptography.SHA1Cng(); hash1 's "Non-Public Members" looks like this: whereas hash2 's "Non-Public Members" looks like this: So it seems like for hash1, only the private field (m_bDisposed) appears

HowTo get all interfaces types from visual studio solution?

↘锁芯ラ 提交于 2019-12-05 21:05:16
I'm trying to write an extension to visual studio. I need to get a list of all the interfaces types found in all the projects in the current opened solution . So far i have tried doing this using the EnvDev namespace. Is there a way of doing this without parsing the project's .cs files ? Thanks, Chai. 来源: https://stackoverflow.com/questions/13051397/howto-get-all-interfaces-types-from-visual-studio-solution

How to register key binding code on VSIX package installation

不想你离开。 提交于 2019-12-05 20:11:39
I'd like to add keyboard shortcut to Visual Studio package only once, during its installation. Basically I know how to do it from the package code, for example: var dte = GetGlobalService(typeof(DTE)) as DTE2; if (dte != null) { dte.Commands.Item("Tools.Something").Bindings = "Global::Ctrl+T, Ctrl+S"; } The problem is, I'd like to invoke this code only once (I don't want to execute this code in package class constructor, because it will execute each time the package will be used first time after VS restart). How to do it ? There is another way I wasn't aware last time. All what need to be done

Visual Studio Remote Debugging Extensibility

这一生的挚爱 提交于 2019-12-05 19:56:22
I'm trying to attach to a remote machine with code similar to the following: Debugger2 db (Debugger2)dte.Debugger; Transport trans = db.Transports.Item("Default"); Process2 proc2 = (Process2)db.GetProcesses(trans, "MACHINENAME").Item("SERVICENAME"); proc2.Attach2(); I've gotten it to work by logging on through remote desktop and manually starting the debugger, but I have to stay logged in. The problem is, I don't want to stay logged into the remote machine. Is there a way to automatically launch the debugger, similar to what happens when I attach through the IDE? You could wrap your debugging

my vs2008 addin for textformatting is awfully slow

你离开我真会死。 提交于 2019-12-05 18:22:07
i wrote a little addin, which does some formatting of my C# code. in the addins Exec method i do the following try { TextSelection selection = (EnvDTE.TextSelection)_applicationObject.ActiveDocument.Selection; String foo = String.Empty; if (!text.IsEmpty) { foo = someCoolObjectThatFormatsText.Format(selection.Text); selection.Text = foo; // here everything gets painfully slow :-( } } catch (Exception) { throw; } when the line with the code "SelectedText.Text = foobar;" is call, VS rebuilds each line of the selection step by step. You can easily watch it doing this step. But i don't get, why it

How to define classification formats for each theme

北战南征 提交于 2019-12-05 07:00:51
In my editor extension I use custom classification formats for keywords, identifiers and so on. Of course, there are default formats I could use, because then colors (used by syntax highlighting) will be changed in accordance to the selected theme. Since my custom editor also needs additional classification types (for instance a punctuation type), colors for those types won´t change when the user configures another theme (by switching from Dark to Blue theme, for instance). I would like to know how I can proffer theme-specific formats. Xcalibur The best approach I have found to support

Find out if cursor is inside a method, class or namespace block

℡╲_俬逩灬. 提交于 2019-12-04 22:54:40
I would like to create a Visual Studio addin which can identify if the caret currently is inside a method, class or namespace block, i.e. if the caret moves, the addin should be able to note down the status that the caret is currently inside so-and-so element. If this can be extended to any C# block enclosed in curly braces, e.g. properties, that would be excellent. Although I have checked for similar questions, please let me know if this is a repeat question so I can mark it accordingly. If other VS Addin-related questions are obviously helpful here, please let me know that too. Basically, I

Evaluating expressions using Visual Studio 2005 SDK rather than automation's Debugger::GetExpression

房东的猫 提交于 2019-12-04 20:57:25
I'm looking into writing an addin (or package, if necessary) for Visual Studio 2005 that needs watch window type functionality -- evaluation of expressions and examination of the types. The automation facilities provide Debugger::GetExpression , which is useful enough, but the information provided is a bit crude. From looking through the docs, it sounds like an IDebugExpressionContext2 would be more useful. With one of these it looks as if I can get more information from an expression -- detailed information about the type and any members and so on and so forth, without having everything come