发布期间新的预编译选项对 MVC4应用程序有什么影响?

因此,我最近将 VisualStudio2012更新为 Update2。你瞧,下次我去发布我的应用程序(在这种情况下通过文件发布) ,我注意到有三个新的选项:

  1. 在发布之前删除所有现有文件
  2. 在发布期间预编译(带有指向“配置”的链接)
  3. 从 App _ Data 文件夹中排除文件

第一个和第三个选项非常简单,但是我找不到关于第二个选项的任何文档,因为它适用于 MVC。当我检查它,似乎没有任何改变在网站上生成的文件,我没有看到任何真正的性能变化。

39427 次浏览

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

  • 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.

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.

It is an old question, but I just encounter similar issue and feel something worth sharing.

My error message is same in this post. My project is MVC5, build with Visual Studio 2013 professional. Compilation Error: The type 'ASP.global_asax' exists in both DLLs

In my case, with precompile option, there is a file, App_global.asax.dll, in bin folder, and cause above error message. First, I remove App_global.asax.dll on server, restart application pool, issue is gone. Then I tried another approach, uncheck precompile and republish, redeploy to server, issue is gone.