When I run my MVC4 Web application it gives the following error:
Could not load file or assembly \'WebGrease\' or one of its dependencies. The located assemb
My situation was this: worked fine on my dev machine but got this same "webgrease missing" error on the host platform.
My solution:
1. Removed all .dll's from the \bin directory
2. Removed all of the references from web.config.
3. As I refreshed the home page and got a "some-next.dll was missing" error, I copied that some-next.dll to the bin directory AND added the reference to web.config for each "fresh" dll
Note: Look at the WebGrease.dll properties | details tab - make sure the product version matched the <dependentAssembly>
. In my case, it was this:
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.1.25624" newVersion="1.6.5135.21930" />
</dependentAssembly>
I deleted "bin", "obj" folders for project and and solution "packages" folder, then it worked.
I had the same issue.
This was resolved by
1) running the Package Manager Console
2) in Console, type: 'Install-Package Microsoft.AspNet.Web.Optimization'
which resolved all the incorrect dependencies.
I had to run
Update-Package -Reinstall Microsoft.AspNet.Web.Optimization
That updated my web.config and all references
Just delete the webgrease from packages folder or uninstall it using package console and then run Update-Package -Reinstall Microsoft.AspNet.Web.Optimization
in package cone
Just update WebGrease to 1.6
PM> Update-Package WebGrease -Version 1.6