f# - System.MissingMethodException : Method not found: 'FSharp. Data.HttpResponse

标签 f# f#-data missingmethodexception f#-4.0

我已经使用 Tickspec 在 F# 中为我的应用程序编写了 AT。我正在使用 FSharp.Data.Http.Request 并且收到以下错误:

System.MissingMethodException : Method not found: 'FSharp.Data.HttpResponse     
FSharp.Data.Http.Request(System.String,  
Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Collections.FSharpList`1
<System.Tuple`2<System.String,System.String>>>,  
Microsoft.FSharp.Core.FSharpOption`1<System.Collections.Generic.IEnumerable`1
<System.Tuple`2<System.String,System.String>>>,   
Microsoft.FSharp.Core.FSharpOption`1<System.String>,   
Microsoft.FSharp.Core.FSharpOption`1<FSharp.Data.HttpRequestBody>,    
Microsoft.FSharp.Core.FSharpOption`1<System.Collections.Generic.IEnumerable`
1<System.Tuple`2<System.String,System.String>>>,
Microsoft.FSharp.Core.FSharpOption`1<System.Net.CookieContainer>, 
Microsoft.FSharp.Core.FSharpOption`1<Boolean>, 
Microsoft.FSharp.Core.FSharpOption`1<System.String>, 
Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Core.FSharpFunc`2
<System.Net.HttpWebRequest,System.Net.HttpWebRequest>>)'.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] 
arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, 
Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags 
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at <StartupCode$TickSpec>.$TickSpec.createAction@212-1.Invoke()

FSharp.Data 版本为 2.1.1.0。

fsproj中:

ToolsVersion is 14.0

TargetFrameworkVersion is v4.6.1

F# is 4.0.

我有另一组用于不同应用程序的 AT,并且我使用相同的 FSharp.Data.dll 和相同的 Http.Request 方法,并且它们使用 F# 4.0,我没有遇到任何问题。

我认为该 dll 没有任何问题,因为我在示例应用程序中使用了它,并且我能够使用该 Http.Request 方法。我创建了一个全新的解决方案,因为我认为我可能使用的是旧版本的 FSharp.Core,但 FSharp.Data 仍然存在同样的问题。

我找到的唯一解决方案是针对该特定项目恢复到 F#3.0。我不想使用 F#3.0,因为我们已经将所有其他应用程序转移到 F#4.0

知道如何解决这个问题吗?

最佳答案

将 app.config 或以下内容添加到任何现有配置中。如果您有多个项目。即测试和应用程序,您需要将其添加到两者中。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </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.4.0.0" newVersion="4.4.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

关于f# - System.MissingMethodException : Method not found: 'FSharp. Data.HttpResponse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39412930/

相关文章:

.net - 在F#中使用自定义Marshaller

f# - 我可以在不提供示例的情况下使用 CsvProvider 编写 header 吗?

android - Xamarin.Forms 缺少方法异常 : 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found

f# - List.fold和List.foldBack之间的区别的示例

f# - 为什么这不能在 F# 中编译

json - F# JSON 解析 - 如何使用复杂路径获取属性(由多个属性名称组成)

f# - 在 HtmlProvider<...>.Table.Row> 中自动输入列

grails - Grails集成测试中的奇怪行为

powershell - 未找到方法 : GenericChart when using FSharp. 从 powershell cmdlet 绘制图表

f# - 如何定义和使用 % 作为前缀运算符?