4
目前,当我编译时,我没有在编译窗口中看到cshtml视图中的任何错误。如何强制MVC视图错误导致项目编译失败?
只有当我打开视图时,我才能看到红线下划线的问题。而已。
如果视图中有错误,我需要编译失败。
谢谢。
目前,当我编译时,我没有在编译窗口中看到cshtml视图中的任何错误。如何强制MVC视图错误导致项目编译失败?
只有当我打开视图时,我才能看到红线下划线的问题。而已。
如果视图中有错误,我需要编译失败。
谢谢。
在记事本中打开您的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 ... -->
太好了。谢谢 !! – monstro