vspackage

How do I subscribe to solution and project events from a VSPackage

徘徊边缘 提交于 2019-12-18 11:47:54
问题 I'm developing a language service for Visual Studio through a VSPackage. I need to update my parse data whenever files get added/removed from the solution's projects. I want to subscribe to solution and project events. I tried as follows, but none of these events get fired when I add/remove projects to the solution or add/remove items to projects. DTE dte = (DTE)languageService.GetService(typeof(DTE)); if (dte == null) return; ((Events2)dte.Events).SolutionEvents.ProjectAdded +=

“Visual Studio Integration Package” vs “Visual Studio Add-in”: what is the difference?

和自甴很熟 提交于 2019-12-17 23:38:39
问题 When creating a new extension for visual studio, there are two project options: "Visual Studio Integration Package" and "Visual Studio Add-in". What is the difference between the two project types and when would you use one over the other? 回答1: Ok, you can find a full detailed comparison here (there are also links to the previous parts in the series). But basically, add-ins were available as the VS extension type from the very first versions of the VS and built as the COM components. Later on

How to get reference to 'Roslyn' Workspace object from IVsSolution?

主宰稳场 提交于 2019-12-17 19:52:53
问题 I have a VS Package project from which I need to access Roslyn or Microsoft.CodeAnalysis' Workspace OR Solution object from the loaded IVsSolution. I need to know how I could achieve that ? I found this stackoverflow discussion here which suggests to use PrimaryWorkspace static property of Workspace class which I can't find in Microsoft.CodeAnalysis.Workspace EDIT: I found out that Microsoft.CodeAnalysis does not have this yet but I downloaded the older release of Roslyn from Nuget.org which

How to create command menu item with checkbox?

不羁岁月 提交于 2019-12-12 21:15:51
问题 I'm writing a VSPackage and I need to have menu item with checkbox, just like on this sample image below: I went through this msdn reference regarding .vsct files, bud didn't fine any information explaining how to do it. What I have now is standard menu item with icon and text (code sample from MyPackage.vsct file): <Buttons> <Button guid="guidMyPackageCmdSet" id="cmdidMyPackage" type="Button"> <Icon guid="guidImages" id="myPackageBitmap" /> <CommandFlag>TextChanges</CommandFlag> <CommandFlag

How to open a tool window of a visual studio extension programmatically?

荒凉一梦 提交于 2019-12-12 20:21:45
问题 So I've got two tool windows in my visual studio extension (package) and I'd like to open up the second window via a button on the first window. I expected this to be explained here: "How to: Open a Tool Window Programmatically", but it wasn't. 回答1: You should use either Package.FindToolWindow or IVsUIShell.FindToolWindow to find or create a tool window. If used from your own package (or if you have a reference to the package, just put it there instead of this ): private void OpenFromPackage(

Visual Studio Extensions - support multiple versions of VS

随声附和 提交于 2019-12-12 14:37:10
问题 I've been writing an extension (Editor Classifier project, with some other features chipped in. It works fine on VS2013, but I need to support other versions VS2012 and VS2015(when it is out of Preview). When I just add supported versions in the vsixmanifest , the problem that I'm facing is, the export of ITestContainerDiscoverer or IClassificationTypeRegistryService fails complaining ContractName="Microsoft.VisualStudio.Text.Classification.IClassificationTypeRegistryService")' is not

Visual Debugger for Geometric Objects

喜夏-厌秋 提交于 2019-12-12 08:25:25
问题 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

Open custom user control in tool window using VS Package

耗尽温柔 提交于 2019-12-12 04:00:38
问题 I'm trying to create simple custom command (added in TOOLS menu option) to open the tool bar with custom control in VS 2013 using VS Package project. I'm following https://msdn.microsoft.com/en-us/library/bb165987.aspx this guide but not sure why it's not working. When I click on it, it opens tool window but without content under it. I want to show the MyControl.cs or custom control content under it. I've tried a lot to find it out on Google but no relevent article found for same. I've notice

Create a multilevel submenu in Visual Studio Tools menu

喜夏-厌秋 提交于 2019-12-11 16:18:32
问题 Create a multilevel submenu in Visual Studio Tools menu I am looking to create a multilevel menu within the Visual Studio Tools menu. I would want the structure as seen to be something like below. Tools |->GC |->Licenses--------------------------->| |->Samples |-> Activate |-> Deactivate From the below code in the .vsct file, I am able to get to the structure as below Tools| |->GC->| |->Licenses |->Samples. How would I be able to add a submenu "Licenses" into the GC menu and add the Activate

Is it possible to use .ctc files in Visual Studio 2010 packages?

半城伤御伤魂 提交于 2019-12-11 16:14:12
问题 I have a VSPackage that started life off as a Visual Studio 2005 project, was migrated successfully to Visual Studio 2008 and now it is being migrated to Visual Studio 2010. The problem is that all of the menus are defined in a .ctc file which I understand has now been superseded by the XML-based .vsct file, and they no longer work. Is there a way to get Visual Studio 2010 to recognise the .ctc file as before or am I going to have to convert all of the menus into the .vsct format? Everything