The Microsoft.Web.Optimization package is now obsolete. With the final release of ASP.NET (MVC) 4 you should install the Microsoft ASP.NET Web Optimization Framework:
Install the package from nuget:
Right click on References, Select Manage Nuget Packages. Type Microsoft.AspNet.Web.Optimization in search box and press enter you will get the package. Click on install.
Create and configure bundle(s) in App_Start\BundleConfig.cs:
public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/Scripts/jquery").Include( "~/Scripts/Lib/jquery/jquery-{version}.js", "~/Scripts/Lib/jquery/jquery.*", "~/Scripts/Lib/jquery/jquery-ui-{version}.js") ); bundles.Add(new ScriptBundle("~/Scripts/knockout").Include( "~/Scripts/Lib/knockout/knockout-{version}.js", "~/Scripts/Lib/knockout/knockout-deferred-updates.js") ); } }
Call the RegisterBundles() function from Application_Start() in your global.asax.cs:
using System.Web.Optimization; protected void Application_Start() { ... BundleConfig.RegisterBundles(BundleTable.Bundles); ... }
In your view.cshtml include the Optimization namespace and render the bundle(s):
@using System.Web.Optimization @Scripts.Render("~/Scripts/jquery") @Scripts.Render("~/Scripts/knockout")