Visual Studio插件-自动右键单击

本文关键字:右键 单击 Studio 插件 Visual | 更新日期: 2023-09-27 18:16:08

是否有办法让我的外接程序按下鼠标右键,然后从打开的上下文菜单中选择一个选项?

像这样:

_applicationObject.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Activate();
_applicationObject.ToolWindows.SolutionExplorer.GetItem(projectName).Select(vsUISelectionType.vsUISelectionTypeSelect);
_applicationObject.ExecuteCommand("PRESS RIGHT MOUSE BUTTON");
_applicationObject.ExecuteCommand("CLICK OPTION XPTO FROM CONTECT MENU");

Visual Studio插件-自动右键单击

听从了@Adriano Repetti的建议,发现了这个

_applicationObject.ExecuteCommand("ClassViewContextMenus.ClassViewProject.Rebuild");