简体   繁体   English

无法加载文件或程序集XXX或其依赖项之一。 找到的程序集的清单定义与程序集引用不匹配

[英]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. 在本地运行Asp.Net MVC应用程序时,一切运行正常,但是当应用程序部署在服务器上时,出现此错误。

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. 我最近刚刚通过使用WebGrease的NuGet添加了System.Web.Optimization框架。

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. 如果我检查引用,我的WebGrease版本是1.5.2.14234,高于抱怨找不到该版本的版本-1.5.1.25624。

Within the root web config, I have the following underneath the runtime tag: 在根Web配置中,运行时标签下有以下内容:

<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. 如果我检查服务器上bin文件夹中的WebGrease.dll,则WebGrease DLL的版本为1.5.2.14234。 Who could be requiring the other version 1.5.1.25624 and any idea how this can be solved? 谁可能需要其他版本1.5.1.25624,以及如何解决此问题的任何想法?

Thanks a lot! 非常感谢!

It was a mistake from our end whereby the actual root web config on the server had an incorrect dependentAssembly tag which consisted of: 从我们的角度来看这是一个错误,服务器上的实际根Web配置具有不正确的dependentAssembly标记,其中包括:

<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. 原来,我的bin目录中存在多个导致问题的“ XYZ-Copy.dll”。 I deleted all XYZ-copy.dll files and it worked. 我删除了所有XYZ-copy.dll文件,它可以正常工作。

我只是删除了C:\\ WINDOWS \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ Temporary ASP.NET \\中的所有内容...如果您使用框架4,请尝试C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4。 0.30319 \\ ASP.NET临时文件\\

I tried installing the latest version from Nuget: 我尝试从Nuget安装最新版本:

 install-package WebGrease

ReBuild the application twice and the error went away. 重新生成该应用程序两次,错误消失了。

hope it help somebody! 希望对别人有帮助!

This was resolved by 这是由解决

1) running the Package Manager Console 1)运行软件包管理器控制台

2) in Console, type: 'Install-Package Microsoft.AspNet.Web.Optimization' 2)在控制台中,输入:'Install-Package Microsoft.AspNet.Web.Optimization'

Which resolved all the incorrect dependencies and Successfully added Microsoft.AspNet.Web.Optimization to the Project 解决了所有不正确的依赖关系,并将Microsoft.AspNet.Web.Optimization成功添加到项目中

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集“WebGrease”的依赖项之一。 定位的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly 'WebGrease' one of its dependencies. The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集或其依赖项之一。 找到的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly or one of its dependencies. The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集“System.Web.Mvc”或其依赖项之一。 定位的程序集的清单定义与程序集不匹配 - Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly 无法加载文件或程序集“ Newtonsoft.Json”或其依赖项之一。 清单定义与程序集引用不匹配。 - Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. manifest definition does not match the assembly reference. Windows Universal App:无法加载文件或程序集-找到的程序集的清单定义与程序集引用不匹配 - Windows Universal App: Could not load file or assembly - The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集。 定位的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly. The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集:找到的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly: The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集 &#39;MySql.Data, Version=8.0.29.0.. 找到的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly 'MySql.Data, Version=8.0.29.0.. The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集“AjaxControlToolkit”或其依赖项之一。 该模块应该包含一个程序集清单 - Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The module was expected to contain an assembly manifest 找到的程序集的清单定义与程序集引用不匹配 - The located assembly's manifest definition does not match the assembly reference
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM