我试图创建一个使用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
}
我在,没有任何问题的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
编辑:
添加到参考C:\Program Files (x86)\MSBuild\..\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\.NETPortable\FSharp.Core.dll
解决了上述错误信息,但是有另外一个
Cannot await 'Microsoft.FSharp.Control.FSharpAsync<string>'