The type or namespace name "ScriptBundle" could not be found (did you specify a usage directive or 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 get an error message:

 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 kind of reference problem, but I can't understand it. Please help. What can cause this error?

+4
source share
3 answers
 Install-Package Microsoft.AspNet.Web.Optimization 
+10
source

I got this error when I upgraded the MVC3 project to MVC4. I missed the links to System.Web.Optimization.dll, which is in the NuGet package. Microsoft ASP.NET Web Optimization Framework (Microsoft.AspNet.Web.Optimization).

+1
source

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


All Articles