Visual Studio Development Bookmark and Share   
 index > Visual Studio Extensibility > Add project menu option
 

Add project menu option

Hi All,

I have created a custom template and I need to access it same way we can access the "Class..." and "Components..." in the project menu option.

Ex: C# class can be directly add by right clicking on project in the solution explore >> "Add" >> "Class"

This will directly select to the "C#" class template in "Add New Item" dialog.

First thing I want know is, how can I add menu option to the project menu >> "Add" sub menu?

Finally, how can I select my template directly when I select menu option.

Thanks,

+Dushantha

Dushantha  Tuesday, October 13, 2009 4:01 AM
Hi Chao,

Menu can be added to the "Add" submenu by parenting the button to,

<Parent guid="guidSHLMainMenu" id="IDM_VS_CSCD_PROJECT_ADD"/>

Still I coundn't find a solution to my second quesion. But found a blog explaning how to do that. But the difficulty is to find correct parameters for "AddProjectItemDlg" method.

If you have any clue let me know.

http://social.msdn.microsoft.com/forums/en-US/vsx/thread/fccf2e06-abee-4b5b-a6d6-3576366927f2/

Thanks,

+Dushantha
 
  • Marked As Answer byDushantha Saturday, October 17, 2009 8:11 AM
  •  
Dushantha  Thursday, October 15, 2009 5:58 AM

Hi, Dushantha
Create a small vspackage with a menu could satisfy your needs.  You firstly create a small wizard with a menu command and then change the parent of the created menu Command ID in the VSCT file.
Like
 <Groups>
  <Group guid="guidVSPackage4CmdSet" id="MyMenuGroup" priority="0x0600">
        <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/>
  </Group>
  </Groups>
MyMenuGroup is your own menu group, and IDM_VS_CTXT_PROJNODE is your Context Menu Identifier, when you right click the project Node.(Sorry for not finding the Add Sub menu, because it is really hard to find the Add Sub menu identifier). The follow two links describe the VSCT XML file very clearly, you could learn from it.
http://dotneteers.net/blogs/divedeeper/archive/2008/03/02/LearnVSXNowPart14.aspx
http://dotneteers.net/blogs/divedeeper/archive/2008/07/14/LearnVSXNowPart25.aspx
For your second quesion. I think you can add your own item by using the EnvDTE.ProjectItems.AddFromTemplate method in the method CallBack funciton of your menu command.
Thanks
Chao

Chao Kuo  Wednesday, October 14, 2009 10:45 AM
Hi Chao,

Menu can be added to the "Add" submenu by parenting the button to,

<Parent guid="guidSHLMainMenu" id="IDM_VS_CSCD_PROJECT_ADD"/>

Still I coundn't find a solution to my second quesion. But found a blog explaning how to do that. But the difficulty is to find correct parameters for "AddProjectItemDlg" method.

If you have any clue let me know.

http://social.msdn.microsoft.com/forums/en-US/vsx/thread/fccf2e06-abee-4b5b-a6d6-3576366927f2/

Thanks,

+Dushantha
 
  • Marked As Answer byDushantha Saturday, October 17, 2009 8:11 AM
  •  
Dushantha  Thursday, October 15, 2009 5:58 AM

You can use google to search for other answers

Custom Search

More Threads

• How to get the results of the VS command Edit.FindInFiles
• Broken Help Project!
• Organize namespace???
• URGENT : VS.Net 2005 Macro Connection Oracle Bug
• How to get Custom Designer view in DSL ?
• which template to use ?
• How do I save the aspx page in database instead of some physical location ?
• Clipboard.GetText() Does not work in Macro
• Getting IDesignerHost for WebSite projects in 2005
• VSPackage Custom Editor - Manipulate file belongs to A Project without opening it.