我正在学习F#,方法是在VisualF#中尝试使用tryfsharp.org中的一些示例代码。我使用nuget软件包控制台安装了Fsharp.Data:
Install-Package FSharp.Data
'FSharp.Data 2.1.1' already installed.
Adding 'FSharp.Data 2.1.1' to TryFsharp.
Successfully added 'FSharp.Data 2.1.1' to TryFsharp.当我试图引用它时:
#r "Fsharp.Data.dll"
Program.fs(10,1): error FS0084: Assembly reference 'Fsharp.Data.dll' was not found or is invalid
open Fsharp.Data
Program.fs(11,6): error FS0039: The namespace or module 'Fsharp' is not defined以下是我的项目结构:
|-- ArchitectureExplorer
|-- Backup Files
| |-- ConsoleApplication1
| |-- ConsoleApplication2
| |-- ConsoleApplication3
| |-- ConsoleApplication4
| |-- FSharpKoans
| |-- FsharpInFinance
| |-- TryFsharp
| |-- Tutorial1
| `-- Tutorial2
|-- Blend
| |-- ItemTemplates
| `-- ProjectTemplates
|-- Code Snippets
| |-- JavaScript
| |-- SQL_SSDT
| |-- Visual Basic
| |-- Visual C#
| |-- Visual C++
| |-- Visual Web Developer
| |-- XAML
| `-- XML
|-- Projects
| |-- ConsoleApplication1
| |-- ConsoleApplication2
| |-- ConsoleApplication3
| |-- ConsoleApplication4
| |-- FsharpInFinance
| |-- TryFsharp
| |-- Tutorial1
| |-- Tutorial2
| `-- WpfApplication1
|-- Settings
| |-- CurrentSettings-2015-01-17.vssettings
| |-- CurrentSettings.vssettings
| |-- FontsAndColorsBackup_a4d6a176-b948-4b29-8c66-53c97a1ed7d0.vssettings
| |-- Old.CurrentSettings.vssettings
| `-- Windows Azure Subscriptions.xml
|-- StartPages
|-- Templates
| |-- ItemTemplates
| `-- ProjectTemplates
|-- Visualizers
| |-- attribcache90.bin
| |-- autoexp.cs
| |-- autoexp.dll
| |-- autoexpce.cs
| `-- autoexpce.dll
|-- nuget.config
`-- packages
|-- Deedle.1.0.6
|-- FSharp.Data.2.0.14
|-- FSharp.Data.2.1.1
|-- FsCheck.1.0.4
`-- repositories.config在使用之前还有什么额外的步骤需要做吗?
发布于 2015-01-20 01:23:51
正如您可以从错误消息中推断的那样,您需要使用#r指令指定Fsharp.Data.dll的正确位置。它可以相对于当前目录,也可以是绝对的。
或者(更简单的IMO),您可以安装F#电动工具并使用它的“发送到交互式”功能--只需右键单击参考中的程序集并选择此选项。
发布于 2016-04-06 20:10:33
也许不是最优的解决方案,但为了在交互式F#中进行测试,我使用了实际的路径,如
#r "packages/FSharp.Data.2.2.5/lib/net40/FSharp.Data.dll"
#r "bin/Debug/FSharp.Data.SQLProvider.dll"https://stackoverflow.com/questions/28036215
复制相似问题