vs-extensibility

How can I customise the Project Type / SubType of a VS 2008 Project Template?

I created a trivially simple empty project and chose "File | Export Template". All this works and I can now add a project of that type if I restart VS. What I want to be able to do is customise the tree node that my custom project templates appear under in the New Project dialog. For instance, at the moment they appear directly under 'Vi...

Can I create a new folder with a Visual Studio Item Template

I have successfully created (and manually edited) an Item Template that will add a number of files in one 'shot'. I want these files to all be created under a folder that should be created at the same time. In Project Template .vstemplate files I can specify a Folder element, but the schema does not allow one in the Item Template. Any ...

Visual Studio Extensibility: How to understand when mouse selection is finished in the code editor?

Hi I'm working on Visual Studio package. I need to know when mouse selection is done in the code editor. I have to update some object when selection is changed. Currently we are doing this with CommandListener implementing IOleCommandTarget and attached to the IVsTextView. The problem is that mouse selection doesn't come as a command...

Handle Debugger Events of Visual Studio 2008

Hello, I created an AddIn for Visual Studio, which should handle the case when the user debugs an application and an unhandled exception is thrown. I registered the events "OnExeceptionNotHandled" and "OnExceptionThrown" using the "Events" property of the application object. In the documentation one can read that these events get fired b...

How do you get the current solution directory from a VSPackage?

Rephrasing the question to see if I get some views. Following is how you would get the current solution directory from an add-in: _applicationObject = (DTE2)application; // retrieved from OnConnection method string solutionDir = System.IO.Path.GetDirectoryName(_applicationObject.Solution.FullName); How would you do this via a VSPack...

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

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...

How do I make Visual Studio automatically go to the first error in a build?

This is done manually by going to the "Error List" output window and double-clicking on the first error or pressing F8. Is there a way to automate this? (I'm using C++ if that matters.) ...

Finding a ProjectItem by type name via DTE

Given a type name, is it possible to use DTE to find the ProjectItem that the type is located in? Something similar to how the Navigate To... dialog works in Visual Studio 2010. The closest I could find is Solution.FindProjectItem, but that takes in a file name. Thanks! ...

Visual Studio 2010 Extensibility, MPF and language services

Hi, I am trying to extend Visual Studio 2010 RC to be able to use a custom programming language. The first two things I've tried to do is a syntax highlight/Intellisense feature (easily done, thanks to "Ook!" sample from PDC09) and a possibility to create new project templates (i.e. be able to open *.myproj files). For this second tas...

Visual Studio 2008 Add-in: App.config and web services.

I have created a visual studio add-in for VS2008. The add-in uses as web service to access data required by the developer. However, currently the only way to get the service to work is to add the service bindings to the machine.config of the pc. I know this is a bad idea and its causing errors left and right in my other applications. ...

Read/Write to the Solution GlobalSection from a AddIn

Hi I'm trying to write a Visual Studio 2010 addin, and wish to persist some information in the solution file. For this a custom GlobalSection, or the ability to add to the SolutionProperties globalsection would be ideal. However, I can't find any information whatsoever on how to access the said information from the extensibility obje...

Visual Studio 2010 Extensibility - Custom Project Template Wizard

I've read a fair amount about the improvements of the extensibility story in VS2010 being much improved (i.e. MEF based, etc.), but have yet to get my hands dirty. I've recently ran across a real world scenario that's making me want to dive in, but I'm surprised to not find a lot of helpful info on getting up and running with what I wan...

Visual Studio Team Explorer Add In Package: Emulate "Source Control" icon behavior

I am attempting to write a Visual Studio 2010 add-in for Team Explorer that adds a root node, just underneath each project. This root node should not have any children, and no context menu, just a double-click action. I have used the samples provided here to create a folder node, with leaf nodes underneath. The leaf nodes I can make do a...

Create instances of classes that populate forms in Visual Studio

Hi I want to instantiate classes that I have written in Visual Studio 2008 and then populate a listview with these instances which resides in a form that opens up from within Visual Studio. To give you an example let's say we have a class Employee within our solution. Using VS Extensibility I would like to open a form in VS that contain...

How to add a jscript or html item template via an add-in in visual studio

I'm currenlty working on an add-in and require the functionality to add custom item templates to a project programatically. I'm currently installing the templates (which are of a .zip format) in ..\Visual Studio 2010\Templates\ItemTemplates\. From within the add-in I then call the following code: string templateLocation = (solution as...

Programmatic way of refreshing VS Item Template cache from within Visual Studio Add-In

Is there a way from within a Visual Studio Add-in to get visual studio to rebuild its cache in a similar way to calling DevEnv.exe with the /InstallVSTemplates command? ...

Is there a config type file for Visual Studio Add-In?

When creating a Visual Studio Add-In, how can you utilise an app.config for the add-in. If I add one to the project and deploy it then when the Add-In runs and I programmatically try to access it via the ConfigurationManager.AppSettings its not picking up the config file for the add-in. Am I doing something wrong or is there another mea...

How to find the position equivalent in an iTextEdit of an EditPoint.AbsoluteCharOffset

Hiya, I'm trying delete a class body in using the new Text Editor code model in a Visual Studio 2010 extension. That is, I'm trying to use the Delete method on ITextEdit to delete everything between curly brackets. I can get access to the Absolute Character Position of the start and end of the class using the codeClass.GetStartPoint(...

How to display the ouput window from an add-in?

I currently have a visual studio add-in and have created a new output window pane which I can write text to successfully. However, when the output window is not open or it is minimised then it doesn't open (popup) when I call the Activate() method on the pane. Any ideas how I can achieve this? ...

Get path of a Solution Item file in Visual Studio Add-In

I'm iterating through a solution and its projects and items and need to retrieve the path to the items on disk. I can retrieve the project file name from Project.FullName and can get a project items path using ProjectItem.Properites.Item("FullPath"). However, for an item in the solutions 'Solution Items' folder, the items Properties m...