Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 270
Mark Cassar Avatar asked Oct 25 '13 09:10

Mark Cassar


People also ask

Where is assembly manifest located?

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.

Can not load file or assembly?

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.

Could not load file or assembly log4net or one of its dependencies?

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.


3 Answers

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!

like image 156
Mark Cassar Avatar answered Oct 13 '22 06:10

Mark Cassar


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.

like image 4
LukeP Avatar answered Oct 13 '22 08:10

LukeP


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\

like image 2
Hassue Rana Avatar answered Oct 13 '22 08:10

Hassue Rana