Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the packages path for fsharpc on Mac OS

Tags:

nuget

mono

f#

I have installed FsUnit using NuGet on Mac OS. And I have copied dll-s to lib folder:

$ ls -la lib
total 1336
drwxr-xr-x   5 demas  staff     170 Dec  9 23:39 .
drwxr-xr-x  17 demas  staff     578 Dec  9 23:39 ..
-rw-r--r--   1 demas  staff  488448 Dec  9 23:21 FsCheck.dll
-rw-r--r--   1 demas  staff   39424 Dec  9 23:20 FsUnit.NUnit.dll
-rw-r--r--   1 demas  staff  151552 Dec  9 23:20 nunit.framework.dll

Here is my code:

#light
namespace Tests
open NUnit.Framework
open FsUnit

module module1 =
    let inline public Square x = x * x;

Now I am trying to compile my code but get the error messages:

$ fsharpc --lib:lib some.fs              
F# Compiler for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License

/Users/demas/temporary/under/some.fs(3,6): error FS0039: The namespace or module 'NUnit' is not defined
/Users/demas/temporary/under/some.fs(4,6): error FS0039: The namespace or module 'FsUnit' is not defined
/Users/demas/temporary/under/some.fs(9,7): error FS0039: The type 'TestFixture' is not defined

Looks like fsharpc can not find my libs. How can I fix it ?

like image 293
ceth Avatar asked Oct 20 '22 21:10

ceth


1 Answers

The compiler does not look at all libraries automatically. You need to use -r to explicitly name the libraries that should be referenced:

fsharpc --lib:lib -r:nunit.framework.dll -r:FsUnit.NUnit.dll -r:FsCheck.dll some.fs
like image 160
Tomas Petricek Avatar answered Oct 22 '22 21:10

Tomas Petricek