这是我的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脚本中执行此操作?
答案 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" })
)