Created
October 3, 2012 12:19
-
-
Save DinisCruz/3826642 to your computer and use it in GitHub Desktop.
O2 Script - VisualStudio API - create top menu and hook build events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var visualStudio = new VisualStudio_2010(); | |
| //add a button called "My Custom Code" to the "Tools" Menu (at bottom), which when clicked will | |
| //invoke the myCustomCode function which will show a WinForms MessageBox | |
| Action myCustomCode = ()=>{ | |
| "This is custom code executing".messageBox(); | |
| }; | |
| var toolsMenu = visualStudio.dte().get_Menu("Tools"); | |
| toolsMenu.add_Menu_Button("My Custom Code", myCustomCode); | |
| //Set up a callbacks on build begin and build OK | |
| VisualStudio_2010.On_BuildBegin.add( | |
| ()=>{ | |
| visualStudio.errorList().clear() | |
| .add_Message("There was a build"); | |
| }); | |
| VisualStudio_2010.On_ProjectBuild_OK.add( | |
| (projectFile)=> { | |
| visualStudio.errorList().add_Message("This project compliled OK: {0}".format(projectFile)); | |
| }); | |
| return visualStudio.dte(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment