我有一个 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 项目开发。根据这篇教程,我期望在发布模式下运行应用程序时,会提供js和css的压缩版本。但是实际上,非压缩版本的js和css被提供了。另一方面,如果我在web.config中显式地将debug设置为false,则会正确地提供压缩版本。
似乎是在发布模式下运行应用程序时出现了编译标记转换问题,但我不明白Web.Release.config中有什么问题。
总之,我无法通过在发布模式下运行应用程序来实现捆绑和最小化。