Articles → .NET → Add An Option In Error List Context Menu Visual Studio Add-In

Add An Option In Error List Context Menu Visual Studio Add-In

Create A New Project

  1. Go to file – ‘New project’ - ‘Visual Studio Add-in’

  2. Picture showing the 'Visual Studio Add-in' template in 'New Project' window.
    Click to Enlarge

  3. The following window appears
  4. Picture showing the first window of 'Visual Studio Add-in' wizard
    Click to Enlarge

  5. In the next window, select ‘Create an Add-in using Visual C#’ and click on ‘Next’

  6. Picture showing the step two where programmer will select the programming language
    Click to Enlarge

  7. In the following window click on ‘Next’

  8. Picture showing step three for selecting application host
    Click to Enlarge

  9. In the following window, you can enter the name and description of the add-in. Once you edit the information click on ‘Next’ button.

  10. Picture showing the step four where programmer will add the visual studio add-in name
    Click to Enlarge

  11. In the following figure, don’t select any checkbox. Click on ‘Next’

  12. Picture showing step five where programmer can choose add-ins option
    Click to Enlarge

  13. In the following window, you can add ‘About’ information about the add-in. Once done click on ‘Next’

  14. Picture showing step six where programmer can select if add-ins should offer 'About' box information or not
    Click to Enlarge

  15. Finally, click on ‘Finish’ in the following window

  16. Picture showing summary screen of add-in wizard
    Click to Enlarge

Add Code To Add An Option In Context Menu Of Error List

public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) {
	_applicationObject = (DTE2) application;
	_addInInstance = (AddIn) addInInst;
	if (connectMode == ext_ConnectMode.ext_cm_UISetup) {
		object[] contextGUIDS = new object[] {};
		Commands2 commands = (Commands2) _applicationObject.Commands;
		Microsoft.VisualStudio.CommandBars.CommandBar errorListCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars) _applicationObject.CommandBars)["Error List"];
		CommandBarControl ctrlExportErrorListToExcel = errorListCommandBar.Controls.Add(MsoControlType.msoControlButton, 1, Missing.Value, Missing.Value, Missing.Value);
		ctrlExportErrorListToExcel.Caption = "Export to excel";
		CommandBarButton handler = (CommandBarButton) ctrlExportErrorListToExcel;
		handler.Click += new _CommandBarButtonEvents_ClickEventHandler(handler_Click);

void handler_Click(CommandBarButton Ctrl, ref bool CancelDefault) {
	//  Call method here


Picture showing the output where 'Export to excel' option is displayed in context menu in error window
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Saturday, August 15, 2015


Your Email Id  
Query/FeedbackCharacters remaining 250