我们有一个使用 Microsoft.FSharp.Data.TypeProviders 的 F# 3.1 项目构建。现在我们正在尝试使用 VS2015 构建这个项目,我们在 F# 的这部分遇到了问题。例如,当我尝试使用 Nuget 安装它时,它需要 F# 3.1。我使用 this guide,它看起来已经过时了。
所以我会感谢我的问题的答案:
以下是重现错误的完整描述:
packages.config
:<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FSharp.Core.3" version="0.0.2" targetFramework="net46" />
<package id="FSharp.Data.TypeProviders" version="0.0.1" targetFramework="net46" />
</packages>
program.fs
中添加以下几行:module Test
open Microsoft.FSharp.Data.TypeProviders
type internal DB = SqlDataConnection<"Data Source=MyServer;Initial Catalog=MyDB;Integrated Security=SSPI;">
这是一条错误消息:
The .NET SDK 4.0 or 4.5 tools can not be found
最佳答案
更多历史背景:
1.What part of F# language Microsoft.FSharp.Data.TypeProviders belongs to? It is F# core library or it is one of external libraries? Who is responsible for this library? Where can I find the bug tracker for this part of F# ecosystem?
它不是核心运行时的一部分,即您可以成为一个快乐且高效的 F# 开发人员,而无需与之交互。它由 Microsoft 创建并随 F# 3.0/VS 2012 一起提供,作为一组用于常见 Msft 数据堆栈的内置类型提供程序。在同一版本中添加了作为语言功能的类型提供程序,所以这个库有点展示了可以做的事情。 FS.D.TP 目前没有积极维护。原始版本 4.3.0.0 仍然随 VS 2013 和 VS 2015 一起提供,但自 VS 2012 发布以来没有进行任何更改。源代码可用 here 并且欢迎您在该 repo 中提交错误,也是。
原则上,该库将作为社区项目接管,并从那里作为 nuget 包进行维护/更新。没有什么能真正阻止这一点。然而,对于许多企业客户来说,拥有带有 Msft 签名和支持的库仍然非常重要。所以它一直处于这种不确定状态,它在盒子里但没有更新。
3.What is the current state of Microsoft.FSharp.TypeProviders? Is it outdated and all what I need is to wait some time when the library will be adopted to F# 4.0 and VS2015. Or do I need to switch to other DB-access library?
其中一些已在上面回答。如果您拥有所有必需的依赖项,该库在 F# 3.1 或 F# 4.0 中应该仍然可以完美运行。特别是,您需要安装 .NET 4.0 或 4.5 SDK(您可以获得 Win8/.NET 4.5 SDK here ),因为 TP 依赖于随附的各种可执行代码生成工具(sqlmetal.exe、svutil.exe)。
关于f# - 需要澄清有关 Microsoft.FSharp.Data.TypeProviders,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31770226/