簡體   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

在本地運行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)

我最近剛剛通過使用WebGrease的NuGet添加了System.Web.Optimization框架。

如果我檢查引用,我的WebGrease版本是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文件夾中的WebGrease.dll,則WebGrease 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>

因此,為什么會發出錯誤!

我的項目也遇到了同樣的錯誤。 原來,我的bin目錄中存在多個導致問題的“ XYZ-Copy.dll”。 我刪除了所有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臨時文件\\

我嘗試從Nuget安裝最新版本:

 install-package WebGrease

重新生成該應用程序兩次,錯誤消失了。

希望對別人有幫助!

這是由解決

1)運行軟件包管理器控制台

2)在控制台中,輸入:'Install-Package Microsoft.AspNet.Web.Optimization'

解決了所有不正確的依賴關系,並將Microsoft.AspNet.Web.Optimization成功添加到項目中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM