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.
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.
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> </dependentAssembly>
Change the upper code in Web.config
to the following
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0"/> </dependentAssembly>
It looks like you have reference to older (1.0.0.0?) version of assembly (assuming current version is 1.3.0.0). In this case you need assembly redirect in web.config or better yet recompile your binaries to use latest version.
Another possiblity if latest version shares the same assembly version as old one (1.0.0.0) you need to recompile your code to use the right assembly and make sure correct copy is used (check GAC for wrong one, use fuslogv to investigate what exact file caused the error).
I had the same issue. Another developer upgraded the WebGrease package (as well as others), but something didn't sync or get checked in. I edited the package file to remove the references to the existing package. Then I reinstalled via Package Manager. Finally, I updated the packages.
It seems as though packages won't install or update if the packages.config file does not match the files (including proper versions) in your project. No error is given in the Package Manager though, it just fails to update or install packages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With