我最初发布的解决方案是有问题的(很脏)。正如许多评论者所指出的那样,Microsoft.AspNet.Web.Optimization包中的调整行为已更改,并且该调整不再起作用。目前,该软件包的版本1.1.3根本无法重现该问题。
请参阅System.Web.Optimization.BundleCollection的资源(例如,您可以使用dotPeek)以更好地了解您将要做什么。另请阅读Max
Shmelev的答案。
原始答案 :
将.min.js重命名为.js或执行类似的操作
public static void AddDefaultIgnorePatterns(IgnoreList ignoreList) { if (ignoreList == null) throw new ArgumentNullException("ignoreList"); ignoreList.Ignore("*.intellisense.js"); ignoreList.Ignore("*-vsdoc.js"); ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled); //ignoreList.Ignore("*.min.js", OptimizationMode.WhenDisabled); ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled); } public static void RegisterBundles(BundleCollection bundles) { bundles.IgnoreList.Clear(); AddDefaultIgnorePatterns(bundles.IgnoreList); //NOTE: it's bundles.DirectoryFilter in Microsoft.AspNet.Web.Optimization.1.1.3 and not bundles.IgnoreList //...your pre }


