如何强制MVC视图错误导致项目编译失败?

mon*_*tro 4 compiler-errors asp.net-mvc-3

目前,当我编译时,我没有在编译窗口中看到来自cshtml视图的任何错误.

只有当我打开视图时,我才能看到红线下划线的问题.而已.

如果视图中有错误,我需要编译失败.

谢谢.

jru*_*ell 11

csproj在记事本中打开文件并将MvcBuildViews属性更改为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 ... -->
Run Code Online (Sandbox Code Playgroud)