在ASP.NET MVC 4启用调试模式捆绑和缩小 [英] Enable bundling and minification in debug mode in ASP.NET MVC 4
问题描述
我无法相信我找不到这个其他问题,但:如何来的启用的捆绑在调试模式?我知道它是如何发布模式下启用,但在调试模式下,我不能找到一种方法来使捆绑。
I can't believe I cannot find other questions about this, but: how does one enable bundling in debug mode? I know how it is enabled for release mode, but in debug mode I cannot find a way to enable the bundling.
这甚至可能还是我失去了一些东西?
Is this even possible or am I missing something?
推荐答案
您可以通过添加启用此
BundleTable.EnableOptimizations = true;
在您的RegisterBundles方法(在App_Start文件夹BundleConfig类)。
in your RegisterBundles method (BundleConfig class in the App_Start folder).
检查<一href=\"http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification\">http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification更多资讯
您也可以改变你的web.config:
You could also change your web.config:
<system.web>
<compilation debug="false" />
</system.web>
不过,这将禁用调试模式完全是这样,我建议第一个选项。
But this would disable debug mode entirely so I would recommend the first option.
最后,得到两全其美,这样使用#如果编译器指令:
Finally, to get the best of both worlds, use the #if compiler directive like this:
#if DEBUG
BundleTable.EnableOptimizations = false;
#else
BundleTable.EnableOptimizations = true;
#endif
这篇关于在ASP.NET MVC 4启用调试模式捆绑和缩小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!