C# 无法加载文件或程序集XXX或其依赖项之一。定位的组件';的清单定义与程序集引用不匹配
当在本地运行Asp.NETMVC应用程序时,一切运行正常,但当应用程序部署在服务器上时,我遇到了这个错误C# 无法加载文件或程序集XXX或其依赖项之一。定位的组件';的清单定义与程序集引用不匹配,c#,asp.net,asp.net-mvc,.net-assembly,C#,Asp.net,Asp.net Mvc,.net Assembly,当在本地运行Asp.NETMVC应用程序时,一切运行正常,但当应用程序部署在服务器上时,我遇到了这个错误 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 ma
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)
我最近刚刚通过NuGet添加了System.Web.Optimization
framework,它利用了WebFeel
如果我查看参考资料,我的WebGleep版本是1.5.2.14234,这比抱怨找不到的版本高-1.5.1.25624
在根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>
如果我检查服务器上bin文件夹中的webfleep.dll,则webfleep dll的版本为1.5.2.14234。谁可能需要另一个版本1.5.1.25624?知道如何解决这个问题吗
非常感谢 这是我们这边的一个错误,服务器上的实际根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>
而不是:
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
因此,发出错误的原因 我刚刚删除了C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET中的所有内容\
它的工作。。。如果您使用framework 4,请尝试C:\Windows\Microsoft.NET\framework\v4.0.30319\Temporary ASP.NET文件\我尝试从Nuget安装最新版本:
install-package WebGrease
重新构建应用程序两次,错误就消失了
希望它能帮助别人 我的项目也出现了同样的错误。事实证明,在我的bin目录中有几个“XYZ Copy.dll”导致了这个问题。我删除了所有XYZ-copy.dll文件,它正常工作。这由 1) 运行包管理器控制台 2) 在控制台中,键入:“安装包Microsoft.AspNet.Web.Optimization”
它解决了所有不正确的依赖项,并成功地添加到项目中感谢您的评论,但正如我之前的回答中所述,这是由于web.config文件中的一个错误而解决的,如ex所述。具有更一般的性质(与“WebLibe”无关)如果在未启用32位的情况下启动应用程序池,然后将其更改为启用,则可能会发生此错误。这个答案解决了这个问题。呸,我讨厌这样的东西。我向云备份服务添加了一个项目,它在我的bin目录中创建了一个重复的.dll。谢谢你在正确方向上的提示。乐意帮忙!这些小问题让我发疯!这也是我的问题。在我这方面,在发布过程中,它位于web配置转换中,因为服务器和我的PC的dll具有不同的版本(我打开了上面的代码,并使用bindingRedirect newVersion)。我刚刚取消选中了precompile选项,因为旧的dll只存在于服务器上,以便继续发布。