Build Views command for Visual Studio

A simple command to add to your Visual Studio External Commands menu that will do a sanity check of all your views (and plain old ASPX pages for that matter):

It calls the aspnet_compiler tool on the current web project displaying the results n the Output window:

To set this up, go to Tool > External Tools and add an item with the Command set to to cmd.exe and Arguments set to:

/c echo Build Views for $(ProjectFileName) && if not exist "$(ProjectDir)\web.config" (echo ERROR: Not a web project! && exit) else (call "%VS110COMNTOOLS%\vsvars32.bat" && aspnet_compiler.exe -v temp -p $(ProjectDir) && echo SUCCESS)

If you are running Visual Studio 2010 then change  %VS110COMNTOOLS% to %VS100COMNTOOLS%.

About these ads

Follow

Get every new post delivered to your Inbox.

Join 35 other followers

%d bloggers like this: