0

In my MVC project, I add Kendo to a bundle. It seems always work in my local machine (I never encounter a problem), but when I deploy to our Test/UAT environments, sometimes it works, but sometimes it doesn't. When it doesn't work, the Kendo bundle is not created. You can see below that other bundles are created, but Kendo is missing:

enter image description here

and the error is:

enter image description here

but strangely, when I view source in Chrome, I actually saw kendo included in the html head:

enter image description here

Can anyone tell me why this happens and how to solve it? This puzzles me a lot.

My code:

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
        RegisterScripts(bundles);
        RegisterStyles(bundles);
    }

    public static void RegisterScripts(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                   "~/Scripts/jquery-{version}.js",
                   "~/Scripts/jquery-ui.min.js"));

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

        bundles.Add(new ScriptBundle("~/bundles/jqueryupload").Include(
                    "~/Scripts/jquery.filler*"));

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

        // ...other bundles here

        bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                    "~/Scripts/kendo/kendo.all.min.js",
                    "~/Scripts/kendo/kendo.aspnetmvc.min.js"));

    }

    public static void RegisterStyles(BundleCollection bundles)
    {
        // ...other bundles here

        bundles.Add(new StyleBundle("~/Content/kendo/css").Include(
                   "~/Content/kendo/kendo.common-material.min.css",
                   "~/Content/kendo/kendo.material.min.css"));
    }
}
martial
  • 3,773
  • 8
  • 33
  • 43
  • This is very odd, we use kendo in bundles just like you in your apps for years and we never had that problem before, afaik. – DontVoteMeDown Jan 04 '19 at 11:08
  • When you publish to UAT/Test are the scripts copied over? It'd seem that they could be missing (making sure and eliminating all the possibilities - apologies if it sounds stupid). – Adrian Jan 04 '19 at 15:20
  • @Adriani6 They must have been copied, since sometimes it works (in the same login session) – martial Jan 04 '19 at 17:22

1 Answers1

0

Check the order scripts are being load. jQuery has to be load before kendo. ASP.NET MVC - Bundle Config order

CMartins
  • 3,247
  • 5
  • 38
  • 53