Karl Cassar
Karl Cassar

Reputation: 6473

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?

Upvotes: 5

Views: 1730

Answers (1)

karaxuna
karaxuna

Reputation: 26930

Open *.Web.csproj file and change this:

<MvcBuildViews>false</MvcBuildViews>

to true

Upvotes: 4

Related Questions