vs-extensibility

How to change the Caption of the Command on the toolbar from a Macro in VS2010?

别说谁变了你拦得住时间么 提交于 2019-12-04 19:32:26
From a macro I am accessing a command that is on the toolbar: Dim name As String = "Macros.MyMacros.MyMacros.ToggleExceptions" Dim cmd As EnvDTE.Command = DTE.Commands.Item(name) How do I now change the caption of the command on the toolbar? It does not seem to have the necessary properties. Do I need to cast it to something else? I've implemented it: Private Sub Main() Const BAR_NAME As String = "MenuBar" Const CTL_NAME = "Foo" ChangeCommandCaption(BAR_NAME, CTL_NAME, "Bar") End Sub Private Sub ChangeCommandCaption(ByVal cmdBarName As String, ByVal ctlName As String, ByVal caption As String)

HWnd of Visual Studio 2010

早过忘川 提交于 2019-12-04 06:41:52
Is there a way to get the HWnd pointer to the top window of Visual Studio 2010 from a VSIX extension? (I would like to change the title of the window). Since there are good chances that your VSIX extension will be running in-process with Visual Studio, you should try this: System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle (Note if you do this too early, you'll get VS Splash screen ...) I'm assuming you want to do this programatically in C#? You'll need to define this P/Invoke inside your class: [DllImport("user32.dll")] static extern int SetWindowText(IntPtr hWnd, string text);

Visual Debugger for Geometric Objects

纵饮孤独 提交于 2019-12-04 03:09:15
When working on my library representing geometric objects, Debugging currently looks like this: Here I am viewing the local variables in the Autos , Locals , Watch and Immediate windows. As I have trouble imagining the shape of the object in my mind, I would prefer a graphical component to represent these objects. So I have started creating a Debugger Visualizer to draw the objects. I have it in a public repo on bitbucket here . Right now I cannot get it to work outside of the Console Application I have in the solution with it. What am I doing wrong? here is what it looks like when it works:

VSIX package build failed without showing the reason (Visual Studio bug)

瘦欲@ 提交于 2019-12-03 17:28:46
问题 I have to enabled diagnostic mode of MSBuild project build output verbosity to see this: 1>Done executing task "EnableExtension" -- FAILED. (TaskId:81) 1>Done building target "DeployVsixExtensionFiles" in project "myextension.csproj" -- FAILED.: (TargetId:93) ... 1>Build FAILED. 1> 1>Time Elapsed 00:00:01.27 ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== My problem is I cannot debug the Visual Studio extension package I'm working on, as the build output says something has

How do you cancel a ToolWindowPane or Visual Studio IDE close operation via a VSPackage?

安稳与你 提交于 2019-12-03 17:07:56
I have a VSPackage with a dockable tool window containing form data. If there are unsaved changes in this form, I would like to cancel a close to either the tool window and the visual studio IDE if the user clicks cancel on saving changes before closing. I can perform the save test on close, but I don't see any event handler methods or other options to actually cancel the close. Here is some blurb from the package: private DTE2 _applicationObject = null; ///-------------------------------------------------------------------------------- /// <summary>This property gets the visual studio IDE

How can I match Visual Studio's theme when creating a VSIX tool window?

流过昼夜 提交于 2019-12-03 16:04:19
I am creating an extension for Visual Studio (2012+) that involves a tool window. I was hoping to style the window identically to match the current theme of Visual Studio. However, I am having a great deal of trouble figuring out how to do it. This post suggests that applying no style at all is all that is required, but that does not match my experience thus far (even creating a default VSIX project in VS2017 and adding a tool window shows a button that I would argue is standard WPF in theme and not VS themed, at least when using the dark VS theme in VS2017). This post asked a similar question

How to create green (or blue) squiggle adornments with a Visual Studio extension

喜夏-厌秋 提交于 2019-12-03 12:22:08
I have a Visual Studio extension that show red error squiggles. I also like to provide squiggles with other colors, for example yellow for warnings. Creating red squiggles can be done by extending the ITagger class, along the lines: internal sealed class MySquigglesTagger : ITagger<IErrorTag> { public IEnumerable<ITagSpan<IErrorTag>> GetTags(NormalizedSnapshotSpanCollection spans) { foreach (IMappingTagSpan<MyTokenTag> myTokenTag in this._aggregator.GetTags(spans)) SnapshotSpan tagSpan = myTokenTag.Span.GetSpans(this._sourceBuffer)[0]; yield return new TagSpan<IErrorTag>(tagSpan, new ErrorTag(

How to create extension for SQL Server Management Studio 17 in C# in VS2017?

痞子三分冷 提交于 2019-12-03 07:59:27
问题 I followed simple Hello World sample from Create your first extension: Hello World example from the Microsoft Docs to build an extension for SSMS 2017 Created VSIX project from Extensibility project template Changed "Start External Program" in Project > Properties > Debug to C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe Add -S (localdb)\MSSQLLocalDB -d sampleDB -E in command line arguments as it requires servername/database be specified to run SSMS.exe.

VSIX package build failed without showing the reason (Visual Studio bug)

谁说我不能喝 提交于 2019-12-03 07:19:42
I have to enabled diagnostic mode of MSBuild project build output verbosity to see this: 1>Done executing task "EnableExtension" -- FAILED. (TaskId:81) 1>Done building target "DeployVsixExtensionFiles" in project "myextension.csproj" -- FAILED.: (TargetId:93) ... 1>Build FAILED. 1> 1>Time Elapsed 00:00:01.27 ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== My problem is I cannot debug the Visual Studio extension package I'm working on, as the build output says something has failed. What's wired, the obj and bin folders with all content inside (including vsix package), has

How to add a button to Visual Studio Intellisense

会有一股神秘感。 提交于 2019-12-03 06:20:43
问题 I would like to add a button to the top of the list of options returned by Visual Studio's IntelliSense. When the button is clicked, my custom code will be executed (which will, among other things, cause a popup to appear). I call it 'button' because when the user click the item, I want a popup window to appear, as opposed to the normal IntelliSense action of completing the user's input. Eg When we input a class name into the text editor, normally the static properties and static methods will