Reputation: 4427
I am starting to get my hands dirty with F# on Mac OS X but can't make it to work (F# version is 3.1 and Mono version is 4.0.2). I am using packet for dependency management and have already installed some libraries. This is how my packet.dependencies
file looks like:
source https://nuget.org/api/v2
nuget Neo4jClient >= 1.0.0.664
nuget FsCheck
After mono .paket/paket.exe install
I get related dependencies successfully downloaded into a packages
folder. The auto-generated packet.lock
file looks like the following:
NUGET
remote: https://nuget.org/api/v2
specs:
FsCheck (2.0.5)
FSharp.Core (>= 3.1.2.5)
FSharp.Core (4.0.0.1)
Microsoft.Bcl (1.1.10)
Microsoft.Bcl.Build (>= 1.0.14)
Microsoft.Bcl.Build (1.0.21)
Microsoft.Net.Http (2.2.29)
Microsoft.Bcl (>= 1.1.10)
Microsoft.Bcl.Build (>= 1.0.14)
Neo4jClient (1.0.0.664)
Microsoft.Net.Http
Newtonsoft.Json (>= 6.0.3)
Newtonsoft.Json (7.0.1)
I am trying to reference such libraries within my .fs files:
#if INTERACTIVE
#r "./packages/FsCheck/lib/net45/FsCheck.dll"
#endif
open FsCheck
open FsCheck
statement fails with The namespace or module 'FsCheck' is not defined
.
What am I doing wrong?
EDIT:
Switching to .fsx
(instead of .fs
) and removing the #if
part works fine. With .fs
it compiles but when running the .exe
I get the following exception (I understand it means the .dll
isn't bundled by default, in which case I wonder what the common practice is):
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'FsCheck, Version=2.0.5.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Upvotes: 1
Views: 1391
Reputation: 433
If you are using Xamarin Studio, your project target framework is probably set to .NET 4.0. You can change this in Project Options > Build > General.
You can also specify the target framework in paket.dependencies. You need step 3 though.
framework: net45
source https://nuget.org/api/v2
nuget Neo4jClient >= 1.0.0.664
nuget FsCheck
Upvotes: 1
Reputation: 2291
Your path is missing the version. It should be
#r "./packages/FsCheck.2.0.5/lib/net45/FsCheck.dll"
Upvotes: 1