Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force MVC views errors to fail project compilation?

Currently, when I compile, I don't see in compilation windows any errors from cshtml views.

Only if I open views I could see problems red-line underlined. That's it.

I need my compilation to fail if there are errors in views.

Thanks.

like image 770
monstro Avatar asked Dec 20 '22 10:12

monstro


1 Answers

Open your csproj file in notepad and change the MvcBuildViews property to true.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <!-- other properties ... -->
    <MvcBuildViews>true</MvcBuildViews>
  <!-- the rest of your project file ... -->
like image 187
jrummell Avatar answered Mar 05 '23 02:03

jrummell