【问题标题】:asp.net mvc compile views [duplicate]asp.net mvc 编译视图 [重复]
【发布时间】:2011-08-13 23:01:06
【问题描述】:

可能重复:
Compile Views in ASP.NET MVC

有什么方法可以让我尽早了解我认为的错误信息。 只有在我在浏览器中加载页面后才知道发生了什么,这有点太慢了。 如果我用 ajax 来做......哦,男孩:( 我应该编写某种集成测试来获取我的控制器并检查响应吗? 您在 asp.net mvc 中加快开发速度的方法是什么?

感谢 ;)

【问题讨论】:

标签: asp.net-mvc debugging


【解决方案1】:

您可以使用构建后任务来编译视图。看到这个answer

仅供参考,如果您希望在执行 ajax 帖子时能够看到错误;大多数现代浏览器都可以让您可视化请求和响应。

对于 Firefox,您可以下载 Firebug 并查看 NET 选项卡。

在 Chrome 中,您可以通过按 ctrl+shift+i 打开开发者工具,然后单击网络选项卡

在 IE 中可以按 F12 调出开发者工具。

【讨论】:

    【解决方案2】:

    Resharper 会在您点击构建之前告诉您视图中的错误

    编辑:我可以说,它还为 MVC 开发提供了许多其他有用的功能,例如识别字符串中的视图名称。

    【讨论】:

      【解决方案3】:

      请记住,如果您启用编译视图...您的解决方案可能需要很长时间才能编译。您只能将其激活为发布模式并在发布/调试之间切换,具体取决于您是否要编译视图。

      - Open your .csproject or .vbproject file in a text editor of your choice. It’s just a simple xml file, which is why any editor will do fine.
      - Locate the <PropertyGroup> element that belongs to the configuration you would like to alter.
      - Within this PropertyGroup, add an additional element with “true” as its text value.
      
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
      
      <MvcBuildViews>true</MvcBuildViews>
      

      【讨论】:

        猜你喜欢
        • 2010-09-27
        • 1970-01-01
        • 1970-01-01
        • 2011-04-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多