简体   繁体   中英

How to run current project by visual studio extension

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
}

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM