3

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?

asked Jan 20, 2015 at 1:11

2 Answers 2

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.

answered Jan 20, 2015 at 1:23
3
  • I've installed the F# Power Tools, and I tried to right click on open Fsharp.Data, and select Find all reference, it finds nothing. Can you tell me a little more on how to right-click on assembly in References and select this option please. Commented Jan 20, 2015 at 1:48
  • I right-click on Fsharp.Data and select Send 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 I open Fsharp.Data, it reports error FS0039: The namespace or module 'Fsharp' is not defined. Commented Jan 20, 2015 at 1:58
  • I'm ashamed to tell you that this error is caused by my misspelling: open Fsharp.Data should be open FSharp.Data. But the F# Power Tools you recommended is quite handy. Thank you. Commented Jan 20, 2015 at 2:46
0

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"
answered Apr 6, 2016 at 20:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.