Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some of my asp mvc 4 bundles stop working

Tags:

asp.net-mvc

so all of a sudden my asp mvc 4 bundles stop working:(

I get cancelled as my http status for the bundle URL's.

Any ideas what I do next? I'm using the same virtual paths in my _layout as when it was working

    @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*"));

    }
}
like image 566
Nikos Avatar asked Dec 17 '25 07:12

Nikos


2 Answers

This can happen if your bundle path is the same as an actual path. For example, you have your css in /Content/Css and your build your bundle with the same path thus:

bundles.Add(new StyleBundle("~/Content/Css").Include(
            "~/Content/Css/normalize.css",
            "~/Content/Css/main.css"
        ));
like image 125
Sprintstar Avatar answered Dec 20 '25 00:12

Sprintstar


I had the same issue and after days of trying to figure it out I noticed my jquery version is now 2.x and my bundles are referencing jquery-1.*. I did have problems when updating my site using NuGet last time. I think the crash caused my bundles to get updated, but it did not update my references in code. Hopefully this will save someone days from trying to figure out why it happened to them.

This is what my app generated for me when I created it:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-1.*"));
like image 35
Jason Willett Avatar answered Dec 19 '25 23:12

Jason Willett



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!