CoderJony

The name 'Scripts' does not exist in the current context

This post will show you, how you can fix "The name 'Scripts' does not exist in the current context" error.

Issue

The name 'Scripts' does not exist in the current context - ASP.NET MVC Error

Solution

Just go to your Views folder, open web.config & add this missing key. You're done...!!!

<add namespace="System.Web.Optimization"/>

Things To Remember

  1. You must have the reference of System.Web.Optimization.dll in your project.
  2. If not, just install this package from Nuget with this command - Install-Package Microsoft.AspNet.Web.Optimization.
  3. Ensure that your Views Web.Config file have the reference of System.Web.Optimization.

Example Screenshot

The name 'Scripts' does not exist in the current context - Solution

Buy Me A Coffee