Tuesday, October 22, 2013

How to run MSBuild from EditPlus 3.x


If you are not familiar with EditPlus, it is a handy little text editor that I have been using regularly since I first started programming in Java more than a decade ago.  Before that I was using Notepad to hand-code my Java program files and one of my classmates turned me onto EditPlus as a better alternative to writing my program files in a plain old text editor like Notepad.
In any case, if you want to get your hands on EditPlus, you can download an evaluation version from here: EditPlus Download
The one thing I really like about EditPlus (other than being a fancy text editor), is that it allows for User Configurable Tools to be executed within its interface.
Well, you might ask, why not just use the Visual Studio IDE??
In many cases, I would do so, but the biggest problem I have found with using the Visual Studio IDE is that, first of all, it is by far not a lightweight tool, and second of all, it is not very robust and reliable when it comes to executing 3rd party tools such as MSBuild within its interface.  At least with earlier versions of the IDE (Visual Studio 2010 and earlier), I could frequently get the IDE to crash by passing too many arguments or executing a very long MSBuild script.
Therefore, I almost always use good ol’ reliable EditPlus when executing my MSBuild scripts.
The steps to configure and run MSBuild from within EditPlus are rather simple:
  1. From the Tools menu, click on Configure User Tools
  2. When the Configure User Tools dialog opens, click on the button Add Tool
  3. From the pop-up menu, select Program
  4. Now proceed to enter the details required for MSBuild to execute
  5. For the Menu text field, enter a name for the tool such as MSBuild
  6. For the command field, enter the path to MSBuild.exe such as C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
  7. For the Argument field, click on the Arrow button, and select “File Path”
  8. If you wish to specify custom targets when executing MSBuild, you can then optionally append the following “/t:” to the string in the Argument field
  9. Finally, if you wish to be able to Prompt for additional arguments (so that you can enter a different target name each time you execute MSBuild), click on the Arrow button again, and select “Prompt for Arguments”
  10. Your resultant command in the Arguments field should then look similar to this: $(FilePath) /t:$(Prompt)
  11. Finally, from the Action field, select the drop down list item for “Capture Output”.  This will allow you to capture MSBuild output in the EditPlus console window rather than within a separate Command Prompt window.
  12. Click on Apply and OK and you are ready to execute MSBuild within EditPlus!
  13. Now, all you have to do is open your selected MSBuild project file within EditPlus and from the Tools menu, you should now have an option to select the name of the MSBuild tool.
  14. You can then select the MSBuild tool, and since you specified that you want to be prompted for arguments, you will be able to enter a specific target name to execute in your MSBuild file. 
  15. That is all there is to it!!





No comments:

Post a Comment