-1

I have a console application which generates json.

I need to execute this application by using a Visual Studio extension (Vsix). For that I created a VSix project with command. When I click run command, I need to run the current project.

I have no idea how to do that.

private void Execute(object sender, EventArgs e)
{
    // Here is my method which is executed when i click it on menu
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

You could try these:

using EnvDTE;

..........


DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE;

dte.ExecuteCommand("Debug.Start");

To run the application without debug, you can try this:

 dte.ExecuteCommand("Debug.StartWithoutDebugging");

And it will debug the current active project when you click the button.

More info, you can refer to this similar issue.

=========================================

And also you could try to use this:

dte.Solution.SolutionBuild.Run();
Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • 1
    Thank you for the answer! The solution working for me was using Dte but dte.Solution.SolutionBuild.Run(); –  Sep 15 '20 at 06:53
  • 1
    Thanks for your feedback and I will add it:) Anyway, have a nice day~ – Mr Qian Sep 15 '20 at 06:57