2010-02-22 64 views
3

我收到以下錯誤任何想法? 只有當控制器調用ValidateForm()方法時,纔會收到此錯誤消息。無法加載文件或程序集'System.Web.Abstractions,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'

無法加載文件或程序集「System.Web.Abstractions,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35」或其某個依賴項。定位的程序集清單定義與程序集引用不匹配。 (來自HRESULT的異常:0x80131040)

回答

7

程序集的正確版本是3.5.0.0。我想你正在使用這個程序集的自定義版本編譯的東西。您可以使用bindingRedirect指示CLR加載程序集的正確版本。

<configuration> 
    <runtime> 
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
      <assemblyIdentity name="System.Web.Abstractions" 
           publicKeyToken="31bf3856ad364e35" 
           culture="neutral" /> 
      <bindingRedirect oldVersion="0.0.0.0" 
          newVersion="3.5.0.0"/> 
     </dependentAssembly> 
     </assemblyBinding> 
    </runtime> 
</configuration> 
0

該版本號似乎是可疑的,因爲我可以在我的機器上找到的唯一正確版本是3.5版本。可能你的代碼是針對CTP/Beta/Preview版本編譯的?

相關問題