MVC 4 @Scripts or @Styles “does not exist”

1. Install Microsoft.AspNet.Web.Optimization using NuGet

2. Add “<add namespace="System.Web.Optimization"/>” to both web.configs (root and view)

3. Call the RegisterBundles() function from Application_Start() in your global.asax.cs:

[code language=”csharp”]
using System.Web.Optimization;

protected void Application_Start() {

BundleConfig.RegisterBundles(BundleTable.Bundles);

}
[/code]

http://stackoverflow.com/questions/10951669/mvc-4-scripts-does-not-exist

http://stackoverflow.com/questions/9475893/how-to-add-reference-to-system-web-optimization-for-mvc-3-converted-to-4-app

Chandra Oemaryadi has written 244 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>