How to precompile razor view in ASP.NET MVC
By default, razor views are not compiled with project. It will compile at runtime.
Razor view will not give you compile time error if you have used wrong property name or property name changes. It throws runtime exception.
You can turn on compilation in your project file.
Open .csproj file in notepad. Find <mvcbuildviews> in .csproj file. Change <MvcBuildViews>false</MvcBuildViews> to <MvcBuildViews>true</MvcBuildViews>.
Now, all the razor views will be precompile with other parts of the MVC project.