我的一些asp mvc 4捆绑包停止工作

时间:2012-12-07 22:27:41

标签: asp.net-mvc

所以突然间我的asp mvc 4捆绑停止了工作:(

我被取消作为捆绑网址的http状态。

我接下来要做什么?我在_layout中使用与工作时相同的虚拟路径

    @Styles.Render("~/foundation/stylesheets")
@Scripts.Render("~/foundation/javascripts")




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

        bundles.Add(new ScriptBundle("~/bundles/jqueryplugins").Include(
            "~/Scripts/plugins/jquery.placeholder.js"));

        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 StyleBundle("~/Content/themes/base/css").Include(
            "~/Content/themes/base/jquery.ui.core.css",
            "~/Content/themes/base/jquery.ui.resizable.css",
            "~/Content/themes/base/jquery.ui.selectable.css",
            "~/Content/themes/base/jquery.ui.accordion.css",
            "~/Content/themes/base/jquery.ui.autocomplete.css",
            "~/Content/themes/base/jquery.ui.button.css",
            "~/Content/themes/base/jquery.ui.dialog.css",
            "~/Content/themes/base/jquery.ui.slider.css",
            "~/Content/themes/base/jquery.ui.tabs.css",
            "~/Content/themes/base/jquery.ui.datepicker.css",
            "~/Content/themes/base/jquery.ui.progressbar.css",
            "~/Content/themes/base/jquery.ui.theme.css"));

        //FOUNDATION STUFF
        bundles.Add(new ScriptBundle("~/foundation/javascripts").Include(
           "~/foundation/javascripts/app.js",
           "~/foundation/javascripts/foundation.min.js",
           "~/foundation/javascripts/modernizr.foundation.js"));

        bundles.Add(new StyleBundle("~/foundation/stylesheets").Include(
            "~/foundation/stylesheets/app.css",
            "~/foundation/stylesheets/foundation*"));

    }
}

4 个答案:

答案 0 :(得分:10)

如果您的捆绑路径与实际路径相同,则会发生这种情况。例如,您在/Content/Css中拥有自己的CSS,并且您使用相同的路径构建捆绑包:

bundles.Add(new StyleBundle("~/Content/Css").Include(
            "~/Content/Css/normalize.css",
            "~/Content/Css/main.css"
        ));

答案 1 :(得分:2)

如果所有这些都被取消,听起来你的路由表就搞砸了。使用http://nuget.org/packages/routedebugger

查看它们

答案 2 :(得分:2)

请勿尝试缩小'.min'文件。 从捆绑包中删除.min文件并使用开发文件。

答案 3 :(得分:2)

我遇到了同样的问题,经过数天的努力弄清楚,我注意到我的jquery版本现在是2.x而我的捆绑包引用了jquery-1。*。我上次使用NuGet更新我的网站时遇到了问题。我认为崩溃导致我的bundle更新,但它没有在代码中更新我的引用。希望这可以节省一些时间来试图找出它们发生在他们身上的原因。

这是我的应用在创建时为我生成的内容:

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