2015-09-25 85 views
3

我在VS 2012中有一个F#项目,F#core 4.3.0和.net 4.5.0通过块金程序包依赖于FSharp.Data。最近,我们分支了一个新版本的软件,并且我们在该分支上更改了.net目标和F#核心版本,因此该项目现在针对F#core 4.3.1和.net 4.5.1。F#绑定重定向不适用于F#4.3.0-4.3.1

不幸的是,在运行时我得到以下错误:

{"[A]Microsoft.FSharp.Core.FSharpOption`1[FSharp.Data.Runtime.BaseTypes.XmlElement] cannot be cast to [B]Microsoft.FSharp.Core.FSharpOption`1[FSharp.Data.Runtime.BaseTypes.XmlElement]. Type A originates from 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\FSharp.Core\v4.0_4.3.0.0__b03f5f7f11d50a3a\FSharp.Core.dll'. Type B originates from 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Script\AutomatedTestLauncher5.4\FSharp.Core.dll'."}

following stackoverflow question's answer,我曾尝试创建我的App.config文件以下绑定重定向:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> 
    </startup> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
</configuration> 

不幸的是,我我再次得到同样的错误。有没有办法来解决这个问题,或者我将不得不寻找另一个框架来做我想要的除了FSharp.Data?

+1

我注意到它看起来像是从自动测试脚本中得到异常。你使用哪个测试跑步者?它会在.config文件中找到吗? (这只会自动发生.exe文件。) –

+0

@MarkSeemann感谢您的评论,您让我阅读错误消息,并注意到错误是指向自动化测试启动器的F#核心,而不是我的其他项目我认为有问题。看起来这个自动化测试脚本(调用其他项目,我得到这个错误)使用F#core 4.3而不是4.3.1,就像我曾经想过的那样,这可能会导致问题。 – Choub890

回答

0

给我的问题的项目被另一个项目调用,我没有改变该项目的绑定重定向。我做了,它解决了问题。