I'm learning F# by trying some example code in tryfsharp.org in Visual F#. I installed the Fsharp.Data
using nuget package console:
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.
When I try to reference it:
#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
Here is my project structure:
|-- 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
Is there any extra step I need to do before using it?
2 Answers 2
As you can infer from you error message, you need to specify correct location of Fsharp.Data.dll with your #r directive. It could be relative to your current directory or absolute.
Alternatively(more easy IMO), you can install F# Power Tools and use it's Send To Interactive feature - just right-click on assembly in References and select this option.
-
I've installed the
F# Power Tools
, and I tried to right click onopen Fsharp.Data
, and selectFind all reference
, it finds nothing. Can you tell me a little more on how toright-click on assembly in References and select this option
please.Nick– Nick01/20/2015 01:48:54Commented Jan 20, 2015 at 1:48 -
I right-click on
Fsharp.Data
and selectSend to Fsharp Interactive
, I got--> Referenced 'C:\Users\Nick\Documents\Visual Studio 2013\packages\FSharp.Data.2.1.1\lib\portable-net40+sl5+wp8+win8\FSharp.Data.dll'
. I consider it a successful action. But when Iopen Fsharp.Data
, it reportserror FS0039: The namespace or module 'Fsharp' is not defined
.Nick– Nick01/20/2015 01:58:34Commented Jan 20, 2015 at 1:58 -
I'm ashamed to tell you that this error is caused by my misspelling:
open Fsharp.Data
should beopen FSharp.Data
. But theF# Power Tools
you recommended is quite handy. Thank you.Nick– Nick01/20/2015 02:46:03Commented Jan 20, 2015 at 2:46
Maybe not optimal solution but for testing purposes in interactive F# I use real paths like
#r "packages/FSharp.Data.2.2.5/lib/net40/FSharp.Data.dll"
#r "bin/Debug/FSharp.Data.SQLProvider.dll"