目前,当我编译时,我没有在编译窗口中看到来自cshtml视图的任何错误。
只有当我打开视图时,才能看到红线下划线的问题。就是这样。
如果视图中有错误,我需要编译失败。
感谢。
答案 0 :(得分: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 ... -->