I want to add a new option in Visual Studio 2010's solution explorer's context menu for a specific file type. So for example, right clicking on a *.cs file will show the existing context menu plus "my new option".
I'm wondering what the code would look like; and would love a pointer to a good reference for developing visual studio plug-ins. The tutorials/references I'm seeing are conspicuously horrid.
Thanks!
I found myself having to add an item to the code editor window context menu, which ended up being
cmdBars["Script Context"]
as I was wanting it specifically for JavaScript files.As a technique for finding this which I felt useful sharing, I added the new menu item to all (456) menu controls in visual studio with the following loop:
I then narrowed this using a divide and conquer technique by adjusting the bounds of the loop:
Until I eventually found what I was looking for.
(The related question for this is at Visual Studio 2010 Plug-in - Adding a context-menu to the Editor Window)
It took me about 5 hours to do this.
There are 2 options, Visual studio Add-in (or shared Add-in) vs Visual studio package.
The package is far more complicated to give you far more control, but for a context menu on the solution explorer it is not needed.
So new project-> Other Project Types -> Extensibility -> Visual Studio Add-in.
Here's a walk-through - Link
Also This one I followed some - Link
I recommend you leave on the option for add to tools menu until you have the context menu working, or to provide a place to put a settings dialog (if you don't write a Tool-> options page.
Here's the connection code:
This code checks to see if what the user has selected is a project for instance:
Note that certain string names in your code have to match up and I'm not sure which ones they are quite yet as I just did this yesterday.
UPDATE:
GAX/GAT for VS2010 also available from http://msdn.microsoft.com/en-us/library/ff687173
ORIGINAL POST
Well is horrid because VS is really complex. Using GAX/GAT was possible, but there's no VS2010 Version yet. What I suggest is downloading some samples from the Visual Studio Gallery to try to understand how the whole thing works, sadly not an easy task.
HTH
I found that the best way to go was to make a Visual Studio Package instead of an Visual Studio Add-in. The vsix deployment experience is so slick - the whole thing was a really easy experience. It only supports Visual Studio 2010, but that was good enough in my case.
Here is the resulting vsct: