In my mvc application, In the _Layout.cshtml has code below...
Please Follow My Step will Clear this
First
Microsoft.AspNet.Web.Optimisation
App_Start
Folder contains a BundleConfig.cs
File.<namespaces>
<add namespace="System.Web.Optimization"/>
</namespaces>
in Views/web.config
FileBundleConfig.RegisterBundles(BundleTable.Bundles);
in Global.asax.cs
In VisualStudio 2019,I was able to solve this error. Microsoft.Web.Optimization is now included in the 'Microsoft.AspNet.Web.Optimization' package. Using NuGet Packing Manager download the package. In .cshtml file add "@using System.Web.Optimization;
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>