Home » ASP » ASP.MVC » Could not load file or assembly WebGrease Update with Nuget

Could not load file or assembly WebGrease Update with Nuget

I decided to update all my Nuget’s packages and one more time, WebGrease could not update correctly. The solution’s projects compile but when executing them website on IIS an error message raises.

Could not load file or assembly ‘WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies

WebGreasePage
The web.config seems legit:

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

The .dll in the project is also with the version 1.6.5135.21930.
WebGreaseDllVersion

So why does the project does not want to execute? The problem was that the Global Assembly Cache had a version that was taking over. You can go into the GAC’s folders, C:\Windows\Microsoft.NET\assembly\ or %windir%\Microsoft.NET\assembly and see 3 folders. One for GAC_32, GAC_64 and GAC_MSIL. After deleting the WebGrease folder ones in those folders and then be sure that none of WebGrease is into the Asp.Net Temporary folders. To be also sure that the cache of Asp is not having the wrong DLL, be sure to clear C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\.

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.