在构建期间检查剃刀错误 [英] Check for razor errors during build

查看:25
本文介绍了在构建期间检查剃刀错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio(我使用的是 2010)是否可以像 C# 项目中的其他代码一样,在构建期间查找 razor 视图中的错误?

Is there a way for Visual Studio (I'm using 2010) to find errors within razor views during builds, in the same way as other code in a C# project would?

您可以检查代码中的任何错误并认为一切正常,这只是一种痛苦,但除非您逐一检查视图,否则似乎无法确定视图.

It's just a pain that you can check any errors in your code and think that everything's fine, but it appears that you can't be sure about views unless you go through each one.

顺便说一句,我显然不会在我的视图中编写代码 - 例如,我只是在谈论 HTML 或 URL 扩展方法.

BTW I obviously don't code in my views - I'm just talking about HTML or URL extension methods for example.

推荐答案

尝试在您的项目文件中将 MVCBuildViews 设置为 true(即编辑您的 csproj 文件)

Try setting MVCBuildViews to true in your project file (i.e. edit your csproj file)

 <MvcBuildViews>true</MvcBuildViews>

这篇关于在构建期间检查剃刀错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆