2

当我通过 nuget 从Microsoft ASP.NET Web Optimization Framework 1.0.0-beta2升级 到Microsoft ASP.NET Web Optimization Framework 1.0.0时,我的一些脚本不再呈现到页面上。这看起来很奇怪,我想知道我是否需要做一些修改来升级它。

使用 beta2,我得到了以下脚本:

<script src="/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-1.8.1.js" type="text/javascript"></script>
<script src="/Scripts/less-1.3.0.min.js" type="text/javascript"></script>
<script src="/Scripts/bootstrap.min.js" type="text/javascript"></script>
<script src="/Scripts/coffee-script.js" type="text/javascript"></script>
<script src="/Scripts/underscore-min.js" type="text/javascript"></script>
<script src="/Scripts/knockout-2.0.0.js" type="text/javascript"></script>
<script src="/Scripts/knockout-2.1.0.js" type="text/javascript"></script>
<script src="/Scripts/backbone-min.js" type="text/javascript"></script>
<script src="/Scripts/backbone-modelref.js" type="text/javascript"></script>
<script src="/Scripts/backbone-relational.js" type="text/javascript"></script>
<script src="/Scripts/knockback.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.gridster.min.js" type="text/javascript"></script>
<script src="/Scripts/dragdealer.js" type="text/javascript"></script>
<script src="/Scripts/pminject.coffee" type="text/javascript"></script>

但使用 RTM 我只能得到:

<script src="/Scripts/jquery-1.8.1.js"></script>
<script src="/Scripts/coffee-script.js"></script>
<script src="/Scripts/underscore-min.js"></script>
<script src="/Scripts/knockout-2.0.0.debug.js"></script>
<script src="/Scripts/knockout-2.1.0.debug.js"></script>
<script src="/Scripts/backbone-min.js"></script>
<script src="/Scripts/backbone-modelref.js"></script>
<script src="/Scripts/backbone-relational.js"></script>
<script src="/Scripts/dragdealer.js"></script>
<script src="/Scripts/pminject.coffee"></script>

我的捆绑配置非常简单:

public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-1.*"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        "~/Scripts/jquery-ui*"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*"));

            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/openid").Include(
                        "~/Scripts/openid-jquery.js",
                        "~/Scripts/openid-en.js"));

            bundles.Add(new ScriptBundle("~/bundles/less").Include(
                        "~/Scripts/less-1.*"));

            bundles.Add(new ScriptBundle("~/bundles/coffeescript").Include(
                        "~/Scripts/coffee-script.js"));

            bundles.Add(new ScriptBundle("~/bundles/underscore").Include(
                        "~/Scripts/underscore-min.js"));

            bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
                        "~/Scripts/knockout-2.*"));

            bundles.Add(new ScriptBundle("~/bundles/backbone").Include(
                        "~/Scripts/backbone-*"));

            bundles.Add(new ScriptBundle("~/bundles/knockback").Include(
                        "~/Scripts/knockback.min.js"));

            bundles.Add(new ScriptBundle("~/bundles/gridster").Include(
                        "~/Scripts/jquery.gridster.min.js"));

            bundles.Add(new ScriptBundle("~/bundles/dragdealer").Include(
                        "~/Scripts/dragdealer.js"));

            bundles.Add(new ScriptBundle("~/bundles/pminject").Include(
                        "~/Scripts/pminject.coffee"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                        "~/Scripts/bootstrap.min.js"));
}

有谁知道我是否需要做额外的步骤或更改来升级它?

4

1 回答 1

3

从 Beta 到 RTM 的一个区别是,当 debug mode = true 时 *.min.js 默认会被忽略。您可以通过清除 BundleTable.Bundles 上的 IgnoreList 来解决此问题,或者您可以将任何仅具有 .min.js 版本的文件重命名为仅 .js 以便包含它们。

这种行为给许多人带来了问题,因此我们正在研究如何在功能版本中使其更好。

于 2012-09-11T20:09:29.140 回答