Changing menu option in VS.NET

  • Thread starter Thread starter Marina
  • Start date Start date
M

Marina

Hi,

When right clicking a project in Solution Explorer, and chosing the 'Add'
menu, a bunch of choices come up depending on the project type. So there
might be 'Add Module', 'Add Class', 'Add Windows Form', etc.

Is there a way to modify what is on this menu? I would like to include a
custom file type in that menu, that is already defined and appears in the
'Add New Item' dialog box. That way instead of chosing 'Add New Item' and
chosing the right file type from the dialog, someone could just chose it
from the menu.

Thanks
 
Interesting. I found that this is apparently controlled by a file. Fire up a
text editor and open C:\Program Files\Microsoft Visual Studio .NET
2003\VC#\CSharpProjectItems\LocalProjectItems\LocalProjectItems.vsdir
(substitute with your install path). By copying the "new CodeFile.cs" line
and modifying it like so:

...\NewPythonFile.py|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2261|80|#2267|{F
AE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4599|0|PythonFile.py

And then creating an empty file under C:\Program Files\Microsoft Visual
Studio .NET 2003\VC#\CSharpProjectItems called "NewPythonFile.py" the item
shows up under the "Add New Item" dialog and is added successfully to the
project as "NewPythonFile1.py". Of course who knows what all those numbers
and the GUID are for.

The icon in the dialog is the right one, but when added to the project its
shown with the generic text icon.

There's probably a better way to do this, but this should get you started =)
 
I already have all this working.

I already have my new template appearing in the Add New Item dialog - I
mentioned this in my post.

What I don't have, is have it as a separate item when you right click on the
project in Solution Explorer, chose Add, and then get the menu options. The
options in this context menu is what I need to modify.
 
You'll probably have to write an add-in for that. I can't see where these
menu entries can be modified manually.
 
Right, the question is what the add-in looks like. The API is very poorely
documented, especially considering everything is just a huge collection of
objects with some sort of name for everything.

What I'm looking for is sample code that would do this...
 
Back
Top