Add-In: How to Enable\Disable menus in Visual Studio 2008 RRS feed

  • Question

  • Hi all,
    Im developing an add-in for Visual Studio 2008 (.NET 3.5) which, while running, allows a new DTE mode (additional to debug & design).
    I would like to disable some of the menus while entering this mode and enable them back afterwards.
    for example disabling File->Open->Project.
    I tried to do the following:

    OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
    CommandID cmdId = new CommandID(some_guid, some_id);  // one of the menus I want to disable
    MenuCommand mc = mcs.FindCommand(cmdId);
    mc.Enable = false

    but that didn't work. Do you have any ideas as for what I might be doing wrong ?

    Tuesday, December 9, 2008 4:20 PM


All replies