I use VS2010 and Addin, using DTE.ExecuteCommand and commands like Build, Build.Cancel, Build.RebuildSolution, etc.
You can get a command with DTE.Commands.Item(\"xxx\")
You can use immediate window to do it. Simply type '>' and start typing command.