How to register bundles properly?

1.1k Views Asked by At

I added devexpress to my smartadmin mvc5 project. When I run the application I get an error on the browser console that some libraries are not defined. Checking the Application_Start class and the smartadmin and devexpress bundles are being added. But still, I have the same problem. If only one bundle is added it works don't show error on the console but either smartadmin or devexpress don't work. Is there a way that I can use but a bundle or MVC just allow one?

protected void Application_Start()
        {

            AreaRegistration.RegisterAllAreas();
            IdentityConfig.RegisterIdentities();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            DevExtremeBundleConfig.RegisterBundles(BundleTable.Bundles);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


        }
1

There are 1 best solutions below

0
Ricardo On

Probably you are defining libraries that you dont have in your project, you can use multiple bundles, just add them in your RegisterBundles sub like (i use VB):

Public Sub RegisterBundles(ByVal bundles As BundleCollection)
  bundles.Add(New ScriptBundle("~/bundles/jquery").Include(
              "~/Scripts/jquery-{version}.js",
              "~/Scripts/jquery.cookie-1.4.1.min.js"))

  bundles.Add(New ScriptBundle("~/bundles/bootstrap").Include(
              "~/Scripts/bootstrap.js",
              "~/Scripts/bootstrap-datepicker.min.js",
              "~/Scripts/locales/bootstrap-datepicker.pt.min.js",
              "~/Scripts/respond.js"))
End Sub