System.Web.Optimization and Microsoft.Web.Optimization won't load reference in vs 2012

I had the same problem with a VS2010 project I opened in VS2012. The Microsoft.AspNet.Web.Optimization package was missing so I just needed to download it using Nuget Package Manager.

You can run in the console: Install-Package Microsoft.AspNet.Web.Optimization


I know it's confusing, but you will need to Install-Package Microsoft.AspNet.Web.Optimization


Try going to the web.config in the Views folder and removing the following line:

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

That fixed it for me.