When running an Asp.Net MVC application locally, everything runs fine but when application is deployed on the server, I am getting this error.
Could not load file or assembly 'WebGrease, Version=1.5.1.25624, 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)
I have just recently added the System.Web.Optimization
framework through NuGet which makes use of WebGrease.
If I check references, my version of WebGrease is 1.5.2.14234 which is higher than the one complaining about not finding - 1.5.1.25624.
Within the root web config, I have the following underneath the runtime tag:
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
If I check the WebGrease.dll within the bin folder on the server, the version of the WebGrease DLL is 1.5.2.14234. Who could be requiring the other version 1.5.1.25624 and any idea how this can be solved?
Thanks a lot!
File Location This is usually the WinSxS folder in the Windows directory. As manifests that accompany private assemblies, assembly manifests should installed in the directory structure of the application. This is usually a separate file in the same folder as the application's executable file.
Http 5.2. 0.0? In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.
Solution 1 Just remove it from the dll from your project and then try to build the project. Since you don't need that one. In case you want to include that dll, you should check that, the application pool you are using is compatible with the assembly.
It was a mistake from our end whereby the actual root web config on the server had an incorrect dependentAssembly
tag which consisted of:
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
and not:
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
hence why the error was being issued!
I had the same error come up with my project as well. It turns out that there were several "XYZ-Copy.dll"'s in my bin directory that was causing the problem. I deleted all XYZ-copy.dll files and it worked.
i just deleted everything in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET\ its working ... if u r using framework 4 then try C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With