Nick
Nick

Reputation: 9051

Cannot open Fsharp.Data in Visual F#

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?

Upvotes: 3

Views: 1205

Answers (2)

y0j0
y0j0

Reputation: 3602

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"

Upvotes: 0

ntr
ntr

Reputation: 544

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.

Upvotes: 2

Related Questions