Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading WebGrease to version 1.3.0 gets me error

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.

like image 655
Neeraj Mude Avatar asked Nov 29 '12 05:11

Neeraj Mude


4 Answers

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.

like image 122
sec_goat Avatar answered Oct 22 '22 02:10

sec_goat


<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>
like image 33
Hriju Avatar answered Oct 22 '22 03:10

Hriju


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).

like image 4
Alexei Levenkov Avatar answered Oct 22 '22 03:10

Alexei Levenkov


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.

like image 3
roadsunknown Avatar answered Oct 22 '22 03:10

roadsunknown