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;