The title pretty much says it all. I'm writing a visual studio extension in which i'm creating a custom command. In the callback of this command, i need to invoke the "solution level Build command" at some point in my logic. I found one GlobalInvoke(CommandID commandID) method present in OleMenuCommandService class. The CommandID takes two arguments "CommandID(Guid menuGroup, int commandID)". I could not find the Menu Group Guid for the Build Menu Group. Firstly, am i right in the above approach? If no, please guide me to the right approach. If yes, how can i find the Guids and IDs needed to invoke the Build command? Thanks in Advance.
You can call DTE.ExecuteCommand("Build.BuildSolution")
.
If you want to use guid and ID, see the following VB sample:
Sub Run(DTE As DTE2, package As Package)
Dim cmd As EnvDTE.Command
Dim shell As Microsoft.VisualStudio.Shell.Interop.IVsUIShell
Dim arg As Object
Dim guid As System.Guid
Dim serviceProvider As System.IServiceProvider
serviceProvider = New Microsoft.VisualStudio.Shell.ServiceProvider(
CType(DTE, Microsoft.VisualStudio.OLE.Interop.IServiceProvider))
shell = serviceProvider.GetService(GetType(Microsoft.VisualStudio.Shell.Interop.SVsUIShell))
cmd = DTE.Commands.Item("Build.BuildSolution", 0)
guid = New System.Guid(cmd.Guid)
shell.PostExecCommand(guid, cmd.ID, 0, arg)
End Sub