By default, an ASP.NET MVC project doesn’t compile Razor view code when you build it. Hence, errors in the views don’t get caught at compile time.
Sometimes, if I quickly want to see if a change has caused any compilation errors in my views, I’ll open my project file in a text editor and edit this element:
<MvcBuildViews>false</MvcBuildViews>
Set the value to true and you can see if your views compile. I’ll usually set it back to false when I’m done, though you certainly don’t have to.