将程序集的路径添加到FAKE脚本

时间:2015-11-26 19:55:23

标签: f# f#-fake

这是我的FAKE构建脚本:

#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.FscHelper

// Properties
let buildDir = "./build/"

// Targets 
Target "Clean" (fun _ ->
    CleanDir buildDir
)

Target "BuildApp" (fun _ ->
    ["src/app/Main.fs"]
    |> Fsc (fun p ->
              { p with Output = "build/Main.exe" })
)

Target "Default" (fun _ ->
    trace "Hello World from FAKE"
)

// Dependencies
"Clean"
  ==> "BuildApp"
  ==> "Default"

// start build
RunTargetOrDefault "Default"

我的程序使用packages/FSharp.Data/lib/net40/FSharp.Data.dll使用Paket安装的FSharp.Data。

当我从命令行构建它时,我可以将此路径传递给编译器:

$ fsharpc src/app/Main.fs -r packages/FSharp.Data/lib/net40/FSharp.Data.dll 

如何在FAKE脚本中执行此操作?

1 个答案:

答案 0 :(得分:1)

您可以使用References任务使用的记录的Fsc属性指定引用:

Target "BuildApp" (fun _ ->
    ["src/app/Main.fs"]
    |> Fsc (fun p ->
              { p with 
                    References = [ "packages/FSharp.Data/lib/net40/FSharp.Data.dll" ]
                    Output = "build/Main.exe" })
)