locked
Template: Can a Project template also host a menu command? RRS feed

  • Question

  • Hi,

    Is there any way to create a project template that also hosts a menu command?

    (I mean to say adding .vsct file and necessary code to the project template solution)





    Tuesday, September 24, 2013 5:08 AM

Answers

  • Hi,

    I don't think we can make the menu command visible out of the VSPackage.

    You can program VSPackage commands to be visible or hidden, depending on the current state of the VSPackage data or the actions that are currently relevant.

    For more information,please refer to Implementing Menu Commands for Optimal Availability .

    Since this issue has been talked in your another thread, I will merge them into one for bettter management.

    Thanks for your understanding.

    Best Regards,

    Jane.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Santhosh Ramini Wednesday, September 25, 2013 6:58 AM
    Wednesday, September 25, 2013 5:56 AM

All replies

  • Hi All,

    I have created a VsPackage that host a Menu Command which is invisible by default and should be visible if i select any new or existing project (Just like "Project" Menu of Visual studio).

    Do i need to convert that vspackage (that hosts my menu command) as a global service and call that service after project creation?

    (I need same visibility as "Project" Menu)

    Monday, September 23, 2013 10:56 AM
  • Hi,

    The following table shows the properties on the MenuCommand class (which the MPF class OleMenuCommand derives from) that correspond to the OLECMDF flags.

     

    I think you can implement what you need by modifying the MenuCommand.Visible Property  ,which is used to get or set a value indicating whether this menu item is visible.

    For more information,please refer to How to: Create and Handle Commands in VSPackages (C#) .

    Best Regards,

    Jane.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, September 24, 2013 9:21 AM
  • Thanks "Jane Wang" for your Reply.

    I have to access that command visibility out of that package. That command is to be visible only if the selected project is using a "Project Template i have created".

    I am really sorry if my question is not clear and let me know if you need a better explanation.




    Tuesday, September 24, 2013 1:17 PM
  • Hi,

    Project templates are entire projects from which a user can create a new project by using the New Project dialog box. A project template includes all the files necessary to begin a specific type of project. Examples of project templates included with Visual Studio are:

    • Windows Application

    • Class Library

    • Empty Project

    However, Menu Commands are defined as the global behavior in Visual Studio,so I cannot enable the Project template to host a menu command.

    Best Regards,

    Jane.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 25, 2013 5:46 AM
  • Hi,

    I don't think we can make the menu command visible out of the VSPackage.

    You can program VSPackage commands to be visible or hidden, depending on the current state of the VSPackage data or the actions that are currently relevant.

    For more information,please refer to Implementing Menu Commands for Optimal Availability .

    Since this issue has been talked in your another thread, I will merge them into one for bettter management.

    Thanks for your understanding.

    Best Regards,

    Jane.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Santhosh Ramini Wednesday, September 25, 2013 6:58 AM
    Wednesday, September 25, 2013 5:56 AM
  • That's exactly what i want. Thanks "Jane Wang" for your Answer.
    Wednesday, September 25, 2013 6:59 AM