【问题标题】:How to set the packages path for fsharpc on Mac OS如何在 Mac OS 上设置 fsharpc 的包路径
【发布时间】:2015-02-07 21:50:19
【问题描述】:

我已经在 Mac OS 上使用 NuGet 安装了 FsUnit。我已将 dll-s 复制到 lib 文件夹:

$ 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

这是我的代码:

#light
namespace Tests
open NUnit.Framework
open FsUnit

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

现在我正在尝试编译我的代码,但收到错误消息:

$ 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

看起来fsharpc 找不到我的库。我该如何解决?

【问题讨论】:

    标签: f# mono nuget


    【解决方案1】:

    编译器不会自动查看所有库。您需要使用-r 明确命名应引用的库:

    fsharpc --lib:lib -r:nunit.framework.dll -r:FsUnit.NUnit.dll -r:FsCheck.dll some.fs
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-27
      • 1970-01-01
      • 2012-11-15
      • 2018-01-20
      • 2018-07-06
      • 1970-01-01
      • 2015-03-12
      • 1970-01-01
      相关资源
      最近更新 更多