Compile Time Error Checking In MVC View

Your MVC project won’t give any compilation error unless you do some settings. For the settings .csproj here are the steps,

Step 1: Firstly, open your CS Project file from explorer in Notepad.

File explorer


Step 2: You have to open the above selected file into notepad as in the following,


Step 3: Search the MvcBuildViews tag default value that is false. Turn it to true and save the file.


Step 4: Again go to Visual Studio to your Solution, it will ask to reload the project. Select the option marked below and reload the project,

reload project

Step 5: Purposefully do some error in code and compile. You will get the following error,


Hence by this way you will get compilation error in view as well through the above steps.

I hope you enjoyed this article. Attached project will give you more detailed view.

Similar Articles