0

When I right-click on a selected project in the Solution explorer, and choose "Build" on the pop-up, I want to intercept that build command.

I have tried with "Build.BuildOnlyProject" and "Build.BuildSelection", but it doesn't seem that these are the correct ones.

How can I figure out which command is actually being called?

I can intercept the "Build.BuildSolution" command (since I have a VS Extension) when I right-click on the solution, but I want to do the same thing when I right-click on the project.

Igavshne
  • 699
  • 7
  • 33
  • How exactly do you want to intercept and what are you trying to achieve. Understanding your scenario might help others to come up with solutions. – earloc May 13 '17 at 20:04

1 Answers1

1

You can subscribe to EnvDTE80.Commands2.BeforeExecute event and check the command name executing (see How do I know from my VSIX that a build will be followed by a Debug session?). This way you can find what command is fired and intercept it.

Community
  • 1
  • 1
Sergey Vlasov
  • 26,641
  • 3
  • 64
  • 66
  • Thanks, this was awesome. Just what I was looking for. It turns out the command was "ClassViewContextMenus.ClassViewProject.Build". I wouldn't have been able to guess it haha. – Igavshne May 16 '17 at 18:38