Upgrading WebGrease to version 1.3.0 gets me error

asp.net-mvc-3asp.net-mvc-4webgrease

While upgrading WebGrease to version 1.3.0 gets me error:

Could not load file or assembly 'WebGrease, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

Line 6:      <title>@ViewBag.Title</title>
Line 7:      @Styles.Render("~/Content/bundles/bootstrap")

How to resolve this error.

Best Answer

Here is the answer that has worked for me, and it is a combination of some of the above answers. First install / uninstall / reinstall the following packages:

Install-Package Microsoft.AspNet.Web.Optimization 
Update-Package WebGrease
Uninstall-Package Microsoft.AspNet.Web.Optimization
Uninstall-Package WebGrease
Install-Package Microsoft.AspNet.Web.Optimization 
Update-Package WebGrease

Then make a copy of the contents of ~/Views/Shared/_Layout.cshtml delete the _Layout.cshtml file, recreate it and paste the contents back in.

this is the final fix that has worked for me.