Windows应用商店应用和F#

Igo*_*man 5 f# windows-8 windows-runtime windows-store-apps

我正在尝试使用F#创建一个可移植的库,以便与Windows应用商店应用一起使用.我用一个类创建了一个fs文件:

module FunctionalRT

open System.Net
open System.IO

type WebHelper =

    static member DownloadStringAsync (url:string) = async {
        let req = HttpWebRequest.Create(url)
        use! resp = req.AsyncGetResponse()
        use stream = resp.GetResponseStream()
        let reader = new StreamReader(stream) 
        let s = reader.ReadToEnd()
        return s
    }
Run Code Online (Sandbox Code Playgroud)

我在Windows应用商店应用中引用了这个库,没有任何问题.但问题是,我无法访问该FunctionalRT模块WebHelper.当我写using FunctionalRT或尝试使用时FunctionalRT.WebHelper.FunctionalRT,编译器抱怨它不知道它.可能是什么问题?

编辑: 经过一些buidls和清理我得到

The type 'Microsoft.FSharp.Control.FSharpAsync`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'FSharp.Core, Version=2.3.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.  C:\Users\Igor\Documents\Visual Studio 2012\Projects\App3\App3\GroupedItemsPage.xaml.cs  46  13  App3
Run Code Online (Sandbox Code Playgroud)

编辑:

添加引用以C:\Program Files (x86)\MSBuild\..\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\.NETPortable\FSharp.Core.dll解决上面的错误消息,但还有另一个

Cannot await 'Microsoft.FSharp.Control.FSharpAsync<string>'
Run Code Online (Sandbox Code Playgroud)

Mar*_*han 7

您必须在Windows应用商店应用中引用此库才能使其正常工作:

C:\ Program Files(x86)\ Reference Assemblies\Microsoft\FSharp\3.0\Runtime.NETPortable\FSharp.Core.dll

关于FSharpAsync类,请参阅此线程:
从C#引用异步F#数据类型

您可以使用FSharpAsync类型的静态方法来等待返回的对象.