0

私はこれらのいずれかを取得しています:

Could not load file or assembly 'System.Web.Mvc, Version=5.0.0.0, 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) 

それは続く:

=== Pre-bind state information ===
LOG: DisplayName = System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///D:/Websites/Reporting/2016-02-18.2/
LOG: Initial PrivatePath = D:\Websites\Reporting\2016-02-18.2\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Websites\Reporting\2016-02-18.2\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/reports/7733280c/d5adf208/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/reports/7733280c/d5adf208/System.Web.Mvc/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///D:/Websites/Reporting/2016-02-18.2/bin/System.Web.Mvc.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

System.Web.Mvc の正しいバージョンは、D:\Websites\Reporting\2016-02-18.2\bin にあります。私は一晩中このプロジェクトと戦ってきましたが、この問題を乗り越えることができないようです. 価値があるのは、web.config にバインディング リダイレクトもあるということです。

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>

私は通常、dll地獄タイプのものはかなり得意ですが、これは困惑しています.binディレクトリにあるファイルが見つからず、探しているバージョンである為に。

ここからどこへ行けばいいですか?

編集:開発では問題なく動作し、開発マシンのどこかにプロジェクトをデプロイすると問題なく動作することを指摘する必要があります。しかし、ステージング サーバーにデプロイすると、これが発生します。何が違うのかわからない。最初に、TFS ビルドが間違った dll を取得するという問題がありました (copy local = true を持っていて、ヒント パスがあったとしても、まだ間違ったバージョンを取得しており、これを防ぐために古い nuget パッケージ フォルダーを削除する必要がありました)。 . このエラーは何度も発生していますが、これは初めてのことであり、ファイルをチェックしたとき (およびダブル、トリプル、およびクアドラプルでチェックしたとき) は実際には正しいバージョンでした。

4

2 に答える 2

0

Viewsフォルダーのweb.configのさまざまな場所で5.0.0.0を使用していました。バインディング リダイレクトがこの問題を処理しない理由がわかりませんが、それらを 5.2.3.0 に更新すると、ようやく機能し始めました。

于 2016-02-18T08:35:08.200 に答える
0

パス内の dll バージョンにC:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\は、適切なバージョンが必要です。これは、アプリケーションが (システムから) 読み取る場所です。これを更新する必要があります。それ以外の場合は、この場所の dll も更新する Nuget を使用して必要なバージョンをインストールします。コメントI should point out that it works fine in development and it also works fine when I deploy the project somewhere on the the development machine.の理由は、上記のパスのdllバージョンがアプリケーションに必要なものであったため、エラーは発生しませんでした。

于 2016-02-18T10:45:01.010 に答える