Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 725
Karl Cassar Avatar asked Oct 04 '22 15:10

Karl Cassar


1 Answers

Open *.Web.csproj file and change this:

<MvcBuildViews>false</MvcBuildViews>

to true

like image 95
karaxuna Avatar answered Oct 07 '22 20:10

karaxuna