Friday, May 15, 2015

Setting up MSBuild as an External Tool in Visual Studio

If you want to use MSBuild as an External Tool for your MSBuild files, fortunately, this is very easy to accomplish in Visual Studio.

  1. From the Tools menu, click External Tools
  2. When the External Tools dialog displays, click on the Add button
  3. Type in MSBuild (32-bit or 64-bit respectively) and point to the location of your MSBuild executable
  4. For the Arguments, select "Item Path" from the list of available arguments by clicking on the ellipsis (...) button
  5. Check the checkbox for "Use Output window" and "Prompt for arguments"
  6. Click on the OK button
  7. MSBuild will now display as an External Tool listed in your Tools menu
  8. Whenever you want to run your MSBuild (.proj) file, you simply open the MSBuild file and select the External Tool from the Tools menu.
  9. That is all there is to it!!
 The locations of MSBuild for the respective versions of Visual Studio are the following:

Visual Studio 2012:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe, C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe

Visual Studio 2013:  C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe, C:\Program Files (x86)\MSBuild\12.0\Bin\amd64\MSBuild.exe

Visual Studio 2015:  C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe, C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe

No comments:

Post a Comment