问题描述
我需要使用Visual Studio扩展(Vsix)执行此应用程序。为此,我使用命令创建了VSix项目。单击运行命令时,需要运行当前项目。
我不知道该怎么做。
private void Execute(object sender,EventArgs e)
{
// Here is my method which is executed when i click it on menu
}
解决方法
您可以尝试以下方法:
using EnvDTE;
..........
DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE;
dte.ExecuteCommand("Debug.Start");
要在不调试的情况下运行应用程序,可以尝试以下操作:
dte.ExecuteCommand("Debug.StartWithoutDebugging");
当您单击按钮时,它将调试当前的活动项目。
更多信息,您可以参考this similar issue。
======================================
并且您也可以尝试使用此功能:
dte.Solution.SolutionBuild.Run();