After upgrading to webgrease 1.5.1.25624 from nuget, System.IO.FileLoadException is coming
Asked Answered
F

6

37

I am asp.net death page, this is coming after i upgraded webgrease and bootstrap for mvc4 using nuget.

Server Error in '/' Application.


Could not load file or assembly 'WebGrease' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'WebGrease' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'WebGrease' could not be loaded.


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045

Frentz answered 16/7, 2013 at 7:36 Comment(7)
did anyone of you had luck to at least restore the package to the old version?Hygrograph
@Luke94, to restore previous version just reinstall Microsoft ASP.NET Web Optimization Framework. Uninstall-Package Microsoft.AspNet.Web.Optimization Uninstall-Package WebGrease Install-Package Microsoft.AspNet.Web.OptimizationCasares
@Luke94: Yes, I did. Follow Hubo's instructions and it will revert to 1.3.Dyarchy
I've just written an email to webgrease team to let them know. In the meanwhile there's no other option but go back to the old version.Dyarchy
got it to work with @MSRS solutionHygrograph
By the way version 1.3 wasn't working for me either I've got similar issue like this one: #13297902. Now they released version 1.5 and I have Exception from HRESULT: 0x80131045 issue. Holly crap!Rosauraroscius
Please select the answer from dunken as the good one, that's what helped me.Wrangler
P
36

Force uninstall the package using Package Manager Console

uninstall-package -f WebGrease

then install the previous version 1.3.0 using the following command

install-package WebGrease -Version 1.3.0

Open your Web.config file and replace below dependency under runtime tag

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

Pareira answered 16/7, 2013 at 10:21 Comment(4)
I was just writing down the same solution :-) The only thing I did different than you is that I removed the dependent assembly entry before reinstalling WebGreaseHygrograph
Your answer saved my bacon today!Buttons
Depending on your deployment mechanism, the 1.3.0 version of WebGrease.dll might not overwrite the 1.5.1 version. Something to watch out for if you used this answer, deployed, and it was still broken.Emeritaemeritus
I'd advise against using an old WebGrease version. This solution probably no longer wroks. Just changing the dependentassembly like in the answer from dunken does the trick while using the current webgrease.Wrangler
F
8

I had to add the following code in web.config:

    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
        </dependentAssembly>
...
Fatuous answered 7/10, 2013 at 12:50 Comment(1)
This was my issue because our web.configs aren't checked into source since they're environment dependant and compiled for each deployment environment. We use web.config.tmpl files that are templatized with environment variables.Independent
H
5

I had the same error. It was happened because nuget updated WebGrease dll but didn't update a web.config file (especial version of used dll).

So I changed next line in my web.config:

 <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />

to

<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />

Number of version (1.6.5135.21930) I took from dll properties.

After this everything works correct.

Hammy answered 6/6, 2014 at 9:14 Comment(1)
+1. Such begins the seeding of word association "crap" to an otherwise awesome "Nuget" updates....Oleg
H
3

We’re aware of an error in the assembly’s strong name signature and so we’re actively working to release an updated version as soon as possible. For now, we have unlisted the WebGrease 1.5.1 package from nuget.org.

Holliehollifield answered 16/7, 2013 at 20:34 Comment(1)
Something was pulling in that old version. Doing 'uninstall-package -f WebGrease' and then 'install-package WebGrease' installed a newer version, updated the web.config, and everything worked.Palisade
B
0

Try this: Check if the above dll's are in GAC. If so, in your custom app bin folder check if the above dll's are present if so remove them from your reference.

Bield answered 16/7, 2013 at 7:55 Comment(0)
S
0

Removing the "xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" tage from web.config section works fine.

Succentor answered 7/3, 2024 at 7:43 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.