I'm using latest MVC4-RC (.net 4.0) with Microsoft ASP.NET Web Optimization Framework http://nuget.org/packages/Microsoft.AspNet.Web.Optimization/1.0.0-beta3 and I'm receiving this error.
Method not found: 'Void System.Web.Optimization.Bundle..ctor(System.String, System.Web.Optimization.IBundleTransform[])'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found: 'Void System.Web.Optimization.Bundle..ctor(System.String, System.Web.Optimization.IBundleTransform[])'.
[MissingMethodException: Method not found: 'Void System.Web.Optimization.Bundle..ctor(System.String, System.Web.Optimization.IBundleTransform[])'.] App.MVC.BundleConfig.RegisterBundles(BundleCollection bundles) in C:...\App_Start\BundleConfig.cs:53 App.MVC.MvcApplication.Application_Start() in C:...\Global.asax.cs:47
[HttpException (0x80004005): Method not found: 'Void System.Web.Optimization.Bundle..ctor(System.String, System.Web.Optimization.IBundleTransform[])'.] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4057141 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
[HttpException (0x80004005): Method not found: 'Void System.Web.Optimization.Bundle..ctor(System.String, System.Web.Optimization.IBundleTransform[])'.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11700896 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4869125
This the code I'm using:
in global.asax.cs
protected void Application_Start()
{
...
BundleConfig.RegisterBundles(BundleTable.Bundles);
...
and then in App_Start/BundleConfig.cs
using System.Web.Optimization;
namespace App.MVC.App_Start
{
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new Bundle("~/scripts/packed.js", new JsMinify()).Include(
// jquery
"~/Scripts/jquery-1.7.1.js",
"~/Scripts/jquery-ui-1.8.17.js",
"~/Scripts/jquery.validate.js",
"~/Scripts/jquery.validate.unobtrusive.js",
"~/Scripts/jquery.unobtrusive-ajax.js"));
bundles.Add(new Bundle("~/content/css/packed.css", new CssMinify()).Include(
// reset
"~/Content/css/cssreset-min.css",
"~/Content/css/cssfonts-min.css",
// themes
"~/Content/themes/base/jquery-ui-1.8.16.custom.css",
// site
"~/Content/css/Site.css"));
}
}
}
I'm also using Azure with this project and funny this is, first time when I start Azure, I get this error. Then when I just rebuild MVC project and refresh page, it works.
How would I approach solving this?