Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type or namespace name 'ScriptBundle' could not be found (are you missing a using directive or an assembly reference?)

using System.Web;
using System.Web.Optimization;

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                    "~/Scripts/jquery-ui-{version}.js"));

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

I am getting the error:

Error   16  The type or namespace name 'ScriptBundle' could not be found (are you missing a using directive or an assembly reference?)

Looks like some reference issue, but i am not able to figure it out. Please help. What could be causing this error?

like image 816
Vijay Pote Avatar asked May 28 '13 03:05

Vijay Pote


2 Answers

Install-Package Microsoft.AspNet.Web.Optimization
like image 104
Fernando Vezzali Avatar answered Sep 29 '22 01:09

Fernando Vezzali


I got this error when I was upgrading an MVC3 project to MVC4. I was missing the reference to System.Web.Optimization.dll which is in the NuGet package Microsoft ASP.NET Web Optimization Framework (Microsoft.AspNet.Web.Optimization).

like image 36
Brian Avatar answered Sep 29 '22 00:09

Brian