The name 'Scripts' does not exists in the current context in MVC
Please Follow My Step will Clear this
First
- Install
Microsoft.AspNet.Web.Optimisation
- Check that the
App_Start
Folder contains aBundleConfig.cs
File. - Add
<namespaces> <add namespace="System.Web.Optimization"/> </namespaces>
inViews/web.config
File - Add
BundleConfig.RegisterBundles(BundleTable.Bundles);
inGlobal.asax.cs
- Rebuild and Run it
The following in .chtml solves the problem
@using System.Web.Optimization
@Scripts.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
There is still intellisense problem, you can add this code to Application_Start() method that inside global.asax file.
BundleConfig.RegisterBundles(BundleTable.Bundles);
Make sure your ~/Views/Web.Config
adds the System.Web.Optimization
namespace:
<system.web.webPages.razor>
<pages>
<namespaces>
<add namespace="System.Web.Optimization"/>
</namespaces>
</pages>
</system.web.webPages.razor>