【发布时间】:2019-05-01 16:26:51
【问题描述】:
我正在使用 .net Core 和 Visual Studio 2017 编写服务。我想使用 JSON 进行配置,所以我这样定义我的类型:
type ServiceConfig = JsonProvider<"exampleConfig.json", EmbeddedResource="MyService, exampleConfig.json", SampleIsList = true>
在我的程序中,我是这样加载的:
let conf = ServiceConfig.Load "config.json"
当我运行它时,它运行良好,但在 VS 2017 中,我得到一条红色波浪线,并且错误日志显示:
FS3033 类型提供程序“ProviderImplementation.JsonProvider” 在提供的类型的上下文中报告错误 'FSharp.Data.JsonProvider,Sample="exampleConfig.json",SampleIsList="True",EmbeddedResource="MyService, exampleConfig.json"',成员'加载'。错误:方法 'FSharp.Data.Runtime.BaseTypes.IJsonDocument 在类型中找不到 Create(System.IO.TextReader, System.String)' ''。可用的类型中可能缺少此方法 目标程序集。
我该如何摆脱它?
【问题讨论】:
标签: f# .net-core visual-studio-2017 f#-data