For a project I’m doing we had to start a large refactoring round. Therefore it would be useful to get compiler errors on our ASP.NET MVC Views too. Otherwise we had to go through all the screens our self to detect problems.
Luckily ASP.NET MVC offers this feature out-of-the-box:
- Unload your ASP.NET MVC project by right right clicking the project on the solution explorer in VS and choosing unload project
- Right click on the csproj file name and choose Edit.
Somewhere in the csproj file you’ll find the following line:
Change the MvcBuildViews value from
Save the file and reload your project.
From this moment on the views are compiled too each time you build your project.