2016-08-29 79 views
1

試圖運行試驗時,我有以下錯誤:FSharp.Core:無法加載文件或組件

{System.IO.FileLoadException:無法加載文件或組件 「FSharp。 Core,Version = 3.3.1.0,Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a'或其依賴項之一。位於程序集清單定義中的 與程序集 的引用不匹配。 (從HRESULT異常:0x80131040)文件名: 'FSharp.Core,版本= 3.3.1.0,文化=中性 公鑰= b03f5f7f11d50a3a' 在 Register.RegisterResponse .__ DebugDisplay()

Tests.dll

FSharp.Core:3.1.2.5

目標F#運行時:4.3.1.0

目標框架:4.6

輸出類型:類庫

ManageAccount.dll

FSharp.Core:3.1.2.5

目標F#運行時:3.3.1.0

目標框架:.NET便攜式子集(.Net Framework 4.5,ASP.Net Core 1.0,Windows 8)

輸出類型:類庫

我加入了以下應用程序配置到我的測試項目:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" 
          culture="neutral"/> 
     <bindingRedirect oldVersion="3.1.2.5" newVersion="3.3.1.0"/> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
</configuration> 

如果我需要一個應用程序配置,什麼樣的價值應該我bindingRedirect設置爲?

回答

5

嘗試<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.3.1.0" />。這就是大多數F#項目似乎爲FSharp.Core所做的。 (或者newVersion="4.3.1.0",或者如果升級到更新的FSharp.Core,甚至可以使用newVersion="4.4.0.0")。

1

您應該bindingRedirect/newVersion使用最新的版本(4.3.1.0在這種情況下),否則,你可能會從代碼得到Tests.dll組件,其依賴於較新版本的錯誤。

或者你可以更新組件之一(降級Tests.dll或升級ManageAccount.dll)的參考,使他們都使用相同的版本。