Updating WebGrease to version 1.3.0 gives me an error

When updating WebGrease to version 1.3.0 , an error appears:

Failed to load file or assembly "WebGrease, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35" or one of its dependencies. The located assembly 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.

+43
asp.net-mvc-3 asp.net-mvc-4 webgrease
Nov 29 '12 at 5:11
source share
14 answers

Here is the answer that worked for me, and this is a combination of some of the answers above. 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 create a copy of the contents of ~ / Views / Shared / _Layout.cshtml, delete the _Layout.cshtml file, recreate it and paste the contents back.

This is the last fix that worked for me.

+65
Jan 23 '13 at 19:32
source share
 <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 top 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> 
+17
Feb 20 '13 at 9:34
source share

It looks like you have a link to the build version (1.0.0.0?) (Assuming the current version is 1.3.0.0). In this case, you need to redirect the assembly to web.config or better yet recompile your binaries to use the latest version.

Another possibility, if the latest version uses the same build version as the old one (1.0.0.0), you need to recompile your code to use the correct build and make sure that the correct copy is used (check the GAC for the wrong one, use fuslogv to find out which file caused the error).

+4
Nov 29 '12 at 5:29
source share

I had the same problem. Another developer updated the WebGrease package (like the others), but something did not synchronize or was not checked. I edited the package file to remove links to an existing package. Then I reinstalled it through the package manager. Finally, I updated the packages.

It seems that packages will not be installed or updated if the package.config file does not match the files (including the correct versions) in your project. There is no error in the package manager, but you just cannot update or install packages.

+3
Dec 13
source share

The combination of the following resolved the issue for me. First, run the following commands on the package manager command line (similar to the answer provided by sec_goat, but not exactly the same):

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

Then, like Hriju, I needed to change this line in my web.config:

 <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> 

in it:

 <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" /> 
+3
Apr 18 '13 at 17:20
source share

Altering the binding that worked for me:

 <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.3.0.0"/> </dependentAssembly> </assemblyBinding> 

Subtle difference: I did not include this version (1.3.0.0) in the oldVersion attr.

bad cake!

+2
Apr 23 '13 at 18:51
source share

I had a similar problem, except that it was not an error, but a warning. After upgrading WebGrease to 1.3.0, the assembly places the warning source in the advertisement. After making sure that the appropriate assembly was redirected in my web.config file, I eventually created a new _Layout.cshtml view and saved it on top of the old file with the same razor markup as the previous one (copy / paste). After that, the warning went away.

I'm not quite sure what this warning is, but try copying the code into your file by pasting it into a new file and overwriting the original.

If anyone has an idea of ​​why this works, I'm all ears.

+1
Dec 08 2018-12-12T00:
source share

This is a problem with Microsoft.AspNet.Web.Optimization (optimize your forward movement).

You need to downgrade WebGrease by removing Optimization and removing any WebGrease assembly redirects from web.config.

Then reinstall Optimization and make sure not to upgrade WebGrease.

This is a quick fix, but it worked for me!

+1
Jan 09 '13 at 17:09
source share

For the Web API project, I'm working on what really works:

  • Open NuGet Package Manager, click Installed packages , and then uninstall Microsoft.AspNet.Web.Optimization . He will tell you that he will remove WebGrease 1.1.0 . Click Yes .

  • Now reinstall it by clicking the NuGet Online tab and find Microsoft.AspNet.Web.Optimization .

Now everything works as expected.

+1
May 31 '13 at
source share

Thanks @roadsunknown. My configuration was blocked after my host computer froze, which caused my virtual machine to not shut down properly. To solve this problem, I deleted Microsoft.AspNet.Web.Optimization via NuGet, then I had to remove the WebGrease link in packages.config and finally reinstall Microsoft.AspNet.Web.Optimization through NuGet.

0
Jan 12 '13 at 17:48
source share

To fix this, I just updated the package.config file (WEBMATRIX)

 <packages> <package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net40" /> <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" /> <package id="WebGrease" version="1.3.0" targetFramework="net40" /> </packages> 

Hurrah!!!

0
Apr 01 '13 at 15:25
source share

Same as Hriju and Nathan (uninstall, reinstall and update), but instead of omitting the newVersion attribute, I saved it. But since WebGrease switched directly from 1.1.0 to 1.3.0, there was no need for 1.2.0 (as it was with jenson-button-event) (Good luck to JB in Spain, by the way).

 <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.3.0.0" /> 

Pedantic? Maybe, but it’s always in the details, right? This fixed it for me.

Anyway, here, hoping that they will do it right the next update.

0
Apr 24 '13 at 5:38 on
source share

This is what my runtime looks like and works

 <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.3.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> 
0
May 7 '13 at 2:04
source share

In my case, all of these methods did not work. Finally, I solve this problem by removing the Microsoft.AspNet.Web.Optimization and WebGrease Packages packages through the package manager, then I open the project file (.csproj) in Notepad and delete all the entries associated with these two packages, it gives outs that there is a problem . Finally, I install the two packages again through the package manager and run the project. Now everything is working fine.

0
Mar 17 '14 at 13:48
source share



All Articles