- | rssFeed | My book on MSBuild and Team Build | Archives and Categories Monday, September 14, 2009

ASP.NET MVC: Build Views

If you are using ASP.NET MVC you might have noticed that you will not be alerted of build errors that exist in your views until you navigate to those pages. When you do so you'll get a runtime error L Thankfully there is a very easy way to change this. All you have to do is open the project file and change the value for the MvcBuildViews property to true. To do this, follow these steps.

  1. Right-click on the MVC project and select 'Unload Project'
  2. Right-click on the unloaded MVC project and select 'Edit …'. This will open up the project file itself, which of course is an MSBuild file.
  3. Look for the MvcBuildView property and set its value to true. It should be <MvcBuildViews>true</MvcBuildViews>
  4. Save the project file, right-click on the MVC project again and select 'Reload project'

After this if you introduce any build errors into the views then you will be notified when the project is built.

Sayed Ibrahim Hashimi

ASP.NET MVC | msbuild Monday, September 14, 2009 5:37:16 AM (GMT Daylight Time, UTC+01:00)  #     |