【发布时间】:2012-11-09 00:57:24
【问题描述】:
我相信我在某处读到了其中一个项目文件中的设置,允许您在构建 Visual Studio 项目时编译 .cshtml 文件。
刚开始使用MVC/Razor/Query Mobile,当我在.cshtml 文件中的代码块中出现错误时,我对“加载页面错误”感到恼火
【问题讨论】:
标签: asp.net-mvc jquery-mobile razor
我相信我在某处读到了其中一个项目文件中的设置,允许您在构建 Visual Studio 项目时编译 .cshtml 文件。
刚开始使用MVC/Razor/Query Mobile,当我在.cshtml 文件中的代码块中出现错误时,我对“加载页面错误”感到恼火
【问题讨论】:
标签: asp.net-mvc jquery-mobile razor
在 .csproj 文件的 <PropertyGroup> 元素中设置 <MvcBuildViews>true</MvcBuildViews>。
【讨论】:
除了真正的设置,您还需要确保您的 csproj 中的以下设置处于活动状态:
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
【讨论】: