install-package Microsoft.AspNet.Web.Optimization
Create the bundle in Global.asax Application_Start:
var scripts = new ScriptBundle("~/MyBundle");
scripts.IncludeDirectory("~/Scripts/MyDirectory", "*.js");
BundleTable.Bundles.Add(scripts);
-
Add the "System.Web.Optimization" namespace to the "Views" web.config:
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
</pages>
原文
http://stackoverflow.com/questions/9475893/how-to-add-reference-to-system-web-optimization-for-mvc-3-converted-to-4-app