What's the difference between compilation debug=“false” and Release mode?

雨燕双飞 提交于 2019-12-06 20:46:19

问题


In ASP.NET, what's the difference between building a project with in the Web.config and with Release mode in the Configuration Manager?

When would you use one and not the other?


回答1:


Here's the best explanation that I found:

http://odetocode.com/blogs/scott/archive/2005/11/15/debug-and-release-builds-in-asp-net-2-0.aspx




回答2:


ScottGu did a pretty good right up of the differences here on his blog.

I typically use this mode when I need to do debugging inside of Visual Studio or if I'm trying to track down a particularly nasty bug. So I usually run with debug mode to set to false.




回答3:


Depending on how you set up your web app (Web Site model vs Web Application model), you might be deploying un-compiled source code directly to the web server. In that case, the ASP.Net runtime needs to know how you want your code compiled when requests start coming in.




回答4:


When compiling in "Release" mode, the web.release.config file will be used, when compiling in debug mode the web.debug.config file will be used (which both extend web.config). See here for more information on those files.

These files may contain a section like this:

<system.web>
    <compilation debug="true" />
    <!-- Lines removed for clarity. -->
</system.web>

In ASP.NET this setting controls whether bundling or minification is done to optimize page load time.

  • Bundling means: Combine or bundle multiple files into a single file (to reduce the number of page requests).
  • Minification means: Removing unnecessary white space and comments and shortening variable names to one character.

See here for more information on bundling and minification.

The default value for the ´debug´ is false, so the optimatzions are enabled per default.



来源:https://stackoverflow.com/questions/939634/whats-the-difference-between-compilation-debug-false-and-release-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!