BundleTable.Bundles.RegisterTemplateBundles

I have an MVC4 RC project created using VS2010. I'm not sure what happened, and suddenly I started getting the following error:

Error 1 'System.Web.Optimization.BundleCollection' does not contain the definition of 'RegisterTemplateBundles' and the extension method 'RegisterTemplateBundles' takes the first argument of the type You can find "System.Web.Optimization.BundleCollection" (are you missing the using directive or the assembly link?) C : \ xxxx \ xxxx \ Global.asax.cs 40 33 xxxx

The error starts with Application_Start ():

protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); BundleTable.Bundles.RegisterTemplateBundles(); } 

I have the following using statements in the Global.asax.cs file:

 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Http; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; 

Any ideas ????

+6
source share
1 answer

Have you upgraded your optimization package to RC? We removed this method and instead moved the package configuration to the BundleConfig.cs class, which is created by the new project / site template. It has one static method called RegisterBundles, which explicitly shows you which packages are being registered, you should be able to call it global.asax instead (you may need to configure the packages according to your existing application). The goal was, hopefully, to make package customization more transparent and easily customizable.

+4
source

Source: https://habr.com/ru/post/920363/


All Articles