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.
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).
Change the upper code in
Web.config
to the followingIt's a problem with Microsoft.AspNet.Web.Optimization (Optimise moving forward).
You need to downgrade WebGrease by uninstalling Optimise and removing any WebGrease assembly redirects from web.config.
Then reinstall Optimise and make sure you don't upgrade WebGrease.
It's a quick fix but it got my build working!
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:
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.
Same deal as Hriju and Nathan (Uninstall, re-install and update), only instead of omitting the
newVersion
attribute, I kept it. But since WebGrease went from 1.1.0 straight to 1.3.0, there was no need for 1.2.0 (as jenson-button-event had it) (Good luck to JB in Spain, btw).Pedantic? Maybe, but it's always in the details, right? This fixed it for me.
Anyhow, here's to hoping they do it right on the next update.
For a Web API project I'm working on what really worked was the following:
Open NuGet package manager, click in
Installed packages
and then uninstallMicrosoft.AspNet.Web.Optimization
. It prompts it'll removeWebGrease 1.1.0
. HitYes
.Now reinstall it clicking NuGet's Online tab and search for
Microsoft.AspNet.Web.Optimization
.Now everything is working as expected.