【发布时间】:2014-03-31 22:19:04
【问题描述】:
我有这个 web.config 文件,其编译选项设置如下
Web.config
<configuration>
...
<system.web>
<compilation debug="true" targetFramework="4.5" />
...
</system.web>
</configuration>
这是 Visual Studio 默认为发布模式设置的内容。
Web.Release.config
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
我将它用于 MVC4 项目。基于this tutorial,当应用程序在Release Mode 下运行时,我预计将提供 js 和 css 的缩小版本。但这似乎不起作用,并且正在提供 js 和 css 的非缩小版本。另一方面,如果我在 web.config 中将 debug 显式设置为 false,则最小版本将正确提供。
当应用程序在 Release Mode 下运行时,似乎是 compilation 标签转换问题,但我不明白 Web.Release.config 中有什么问题.
简而言之,我无法通过在发布模式下运行应用程序来进行捆绑和缩小工作。
【问题讨论】:
-
我敢打赌这是因为您的应用程序在 IIS 中父应用程序的虚拟目录下运行,并在不存在时继承其配置,因此为什么它在存在时修复它,覆盖父配置!
标签: asp.net asp.net-mvc asp.net-mvc-4 bundling-and-minification web.config-transform