Could not load file or assembly ‘WebGrease’ one of its dependencies. The located assembly’s manifest definition does not match the assembly reference

Usually when you would run an update-package command in Package Manager Console, you would encounter such error messages, in this instance the case is with Webgrease assembly

The reason for this error message is that the application is trying to load a different version of the assembly than what is present in the packages folder, and since there is a mismatch, its failing. A couple of things to quickly check in this scenario are:

  • Check the web.config file for assembly bindings
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="" newVersion="" />
  • Check the version of the assembly referenced in your project

Clearly you can see the mismatch in the version of the referenced assembly and the assembly binding in the web.config file. All you have to do is to update the web.config file with the correct version of the assembly for binding. so,

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

And that should be all!

About Jinish Bhardwaj
Jinish works as a Software Architect for Tucows and has more than 14 years of experience in building high availability real time Web, Windows and Smart Client systems for clients across the globe. Jinish is also a Microsoft Certified Professional and a Certified SCRUM Master

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: