make asp.net MVC 4 views compiled / give errors on compilation, not only on first access

asp.net-mvc-4, compiler-errors, razor, view

Solution

Open *.Web.csproj file and change this:

<MvcBuildViews>false</MvcBuildViews>

to true

Problem

I have a Asp.Net MVC 4 View (Razor), which includes a model like below: ``` @model Project.Models.TestModel ``` The problem is that if I go the project, and rename `TestModel` to `TestModel2`, and I click on rebuild project, no errors are given. If I open up the `.cshtml` file directly, then I do get the error there. Can you enforce such errors to be given immediately at compile time?

Original source