如何在运行前编译 cshtml [英] How to compile cshtml before runtime

查看:33
本文介绍了如何在运行前编译 cshtml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信我在某处读到过一个项目文件中的设置,允许您在构建 Visual Studio 项目时编译 .cshtml 文件.

I believe I read somewhere there is a setting in one of the project files that will allow you to compile the .cshtml files when building your Visual Studio project.

刚刚开始使用 MVC/Razor/Query Mobile,当我在 .cshtml 中的代码块中出现错误时,我对错误加载页面"感到恼火文件

Just getting started with MVC/Razor/Query Mobile, and am getting annoyed with the "Error loading page" when I have an error in a code block inside a .cshtml file

推荐答案

Set <MvcBuildViews>true</MvcBuildViews> 在您的 元素中.csproj 文件.

Set <MvcBuildViews>true</MvcBuildViews> in the <PropertyGroup> element of your .csproj file.

这篇关于如何在运行前编译 cshtml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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