I have MVC4 RC project created with VS2010. I am not sure what happened, all of a sudden I started getting the following error:
Error 1 'System.Web.Optimization.BundleCollection' does not contain a definition for 'RegisterTemplateBundles' and no extension method 'RegisterTemplateBundles' accepting a first argument of type 'System.Web.Optimization.BundleCollection' could be found (are you missing a using directive or an assembly reference?) C:\xxxx\xxxx\Global.asax.cs 40 33 xxxx
The error is comming from Application_Start():
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
BundleTable.Bundles.RegisterTemplateBundles();
}
I have the following using statements in my 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????
Did you upgrade your Optimization package to RC? We removed that method and instead moved the bundle configuration into a BundleConfig.cs class that gets created by the new project/website template. It has a single static method called RegisterBundles which explicitly shows you what bundles are being registered, you should be able to call this in global.asax instead(you might have to tweak the bundles to match your existing app). The goal was to hopefully make bundle setup more transparent and easily tweaked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With