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%.

3 thoughts on “Build Views command for Visual Studio

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s