Hi,
Have written an add-in originally for visual studio 2005, which has been updated to work with VS2010, VS2012 and VS2013.
I'm now at the point where I would like to add buttons to the MVC view editor context menu.
I've enabled VSIPLogging, and the right click brings back the Name 'HTML Context'
However it doesn't appear.
Below is some example code, that works for the 'ASPX Context', but not for the 'HTML Context'
object []contextGUIDS = new object[] { };
Commands2 commands = (Commands2)_applicationObject.Commands;
// Set the toolMenu to HTML Context and it doesn't work
string toolsMenuName = "HTML Context";
// Set the toolMenu to ASPX Context and it does work
//string toolsMenuName = "ASPX Context";
Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars)[toolsMenuName];
try
{
//Add a command to the Commands collection:
Command command = commands.AddNamedCommand2(_addInInstance, "MyAddin1", "MyAddin1", "Executes the command for MyAddin1", true, 59,
ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommandStatusEnabled,
(int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
//Add a control for the command to the tools menu:
if((command != null) && (menuBarCommandBar != null))
{
menuBarCommandBar.Controls.Add(Microsoft.VisualStudio.CommandBars.MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, 1, true);
}
}
catch(System.ArgumentException)
{
//If we are here, then the exception is probably because a command with that name
// already exists. If so there is no need to recreate the command and we can
// safely ignore the exception.
}
Many thanks for any help on this.
Cheers
James