Asp.net mvc 4 在MVC4中,发布模式不生成.min版本

Asp.net mvc 4 在MVC4中,发布模式不生成.min版本,asp.net-mvc-4,minify,bundling-and-minification,Asp.net Mvc 4,Minify,Bundling And Minification,我在Windows764上的VS2012终极版3中创建了一个默认的internet(并尝试了intranet——同样的问题)MVC4文件。然后我将发布模式设置为release而不是Debug,并运行应用程序 在IE 9中,我右键单击并选择了view source,使用的jquery文件与调试模式下的文件相同(不是.min版本): 在发布模式下,我还应该做些什么来启用脚本文件的.min版本的自动使用?我还尝试修改代码以检查是否定义了调试(#if debug),而不是 注意,我用MVC4附带的模

我在Windows764上的VS2012终极版3中创建了一个默认的internet(并尝试了intranet——同样的问题)MVC4文件。然后我将发布模式设置为release而不是Debug,并运行应用程序

在IE 9中,我右键单击并选择了view source,使用的jquery文件与调试模式下的文件相同(不是.min版本):


在发布模式下,我还应该做些什么来启用脚本文件的.min版本的自动使用?我还尝试修改代码以检查是否定义了调试(#if debug),而不是

注意,我用MVC4附带的模板创建的默认应用程序测试了这一点。我根本没有更改它们(我最初在自己的应用程序中遇到了这个问题,想看看这是否是我做的事情)

web配置是默认配置。第一个版本是:


谢谢, -D

我发现了另一条消息(),它有一个解决方法,可以让它正常工作。基本上,我将以下内容添加到
Global.asax.cs
中的
应用程序\u Start

#if !DEBUG 
    BundleTable.EnableOptimizations = true; 
#endif 
这修复了它(或者至少使它按照我预期的方式运行)

谢谢


-D

release.web.config的内容是什么?我已经用release.web.config更新了消息。
<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <!--
    In the example below, the "SetAttributes" transform will change the value of 
    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
    finds an atrribute "name" that has a value of "MyDB".

    <connectionStrings>
      <add name="MyDB" 
        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
  -->
  <system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
    <!--
      In the example below, the "Replace" transform will replace the entire 
      <customErrors> section of your Web.config file.
      Note that because there is only one customErrors section under the 
      <system.web> node, there is no need to use the "xdt:Locator" attribute.

      <customErrors defaultRedirect="GenericError.htm"
        mode="RemoteOnly" xdt:Transform="Replace">
        <error statusCode="500" redirect="InternalError.htm"/>
      </customErrors>
    -->
  </system.web>
</configuration>
#if !DEBUG 
    BundleTable.EnableOptimizations = true; 
#endif