Compile-Time Checking of ASP.NET Views


If you've ever refactored a view model for an ASP.NET site, you're aware that doing so can break the Razor view(s) that the view model is based upon. Furthermore, you won't discover this until the view is invoked at run-time. This article describes how to avoid this by forcing the Razor views to be build at compile-time, thus revealing any issues.



1. Unload Web project

2. Edit Web Project

3. Add the MvcBuildViews line


    . . . 


    . . .