新的发布期间预编译选项对 MVC4 应用程序有什么影响? [英] What effect does the new precompile during publishing option have on MVC4 applications?

查看:17
本文介绍了新的发布期间预编译选项对 MVC4 应用程序有什么影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我最近将 Visual Studio 2012 更新为 Update 2.瞧,下次我去发布我的应用程序(在这种情况下通过文件发布)时,我注意到有三个新选项:

So I recently updated Visual Studio 2012 to Update 2. Lo and behold, the next time I go to publish my application (via File Publish in this case) I notice that there are three new options:

  1. 在发布前删除所有现有文件
  2. 发布期间预编译(带有配置链接)
  3. 从 App_Data 文件夹中排除文件

第一个和第三个选项不言自明,但我找不到关于第二个选项的任何文档,因为它适用于 MVC.当我检查它时,网站上生成的文件似乎没有任何变化,我也没有看到性能有任何真正的变化.

The first and third options are pretty self-explanatory, but I can't find any documentation on the second option as it applies to MVC. When I check it, there doesn't seem to be any change in the files produced on the site and I don't see any real change in performance.

推荐答案

使用 ASP.NET 预编译器会对您的 MVC 应用程序产生以下影响:

Using the ASP.NET precompiler can have the following impact on your MVC app:

  • 如果您在 App_Code 中有任何内容,则会在部署前将其预编译为 DLL.如果没有预编译,这会由 ASP.NET 运行时动态发生.
  • 如果您选择使您的页面可更新的选项(即取消选中高级设置对话框中的第一个复选框),它还会预编译您的视图(ASPX 和 Razor),而不是动态编译它们在运行时也是如此.允许可更新预编译站点"的默认(选中)设置允许您更新您的视图内容,而无需重新构建整个项目.
  • If you have anything in App_Code, it will be precompiled into a DLL before deployment. Without precompiling, this would happen on the fly by the ASP.NET runtime.
  • If you choose the option to not make your pages updateable (i.e. uncheck the first checkbox in the advanced settings dialog), it will also precompile your views (ASPX and Razor) instead of compiling those dynamically at runtime as well. The default (checked) setting of "Allow precompiled site to be updateable" allows you to update your view content without needing to rebuild the entire project.

如果您在 App_Code 中没有任何文件,并且希望您的网站保持可更新,那么它似乎没什么用.

If you don't have any files in App_Code and you want your site to remain updateable, it doesn't seem to do much.

这篇关于新的发布期间预编译选项对 MVC4 应用程序有什么影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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