我可以将参数传递给F#FAKE构建脚本吗? [英] Can I pass a parameter to a F# FAKE build script?

查看:58
本文介绍了我可以将参数传递给F#FAKE构建脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用FAKE.我真的很喜欢这个主意.在教程中,设置构建和部署目录.

I'm just getting started with FAKE. I really like the idea. In the tutorials the set the build and deploy directories.

// Directories
let buildDir  = "./build/"
let testDir   = "./test/"
let deployDir = "./deploy/"

,然后引用那些还可以的参数,但是可以将其作为参数传递吗?也许作为Task在以后可以使用的地方?

and then later reference those which is fine, but is it possible to pass that as a parameter? Maybe to as Task where I can use it later?

推荐答案

类似的方法应该起作用.

Something like this should work.

从命令行:

"..\packages\Fake.3.7.5\tools\Fake.exe" "build.fsx" dir=my/custom/dir/

在build.fsx脚本中:

In the build.fsx script:

let buildDir = getBuildParamOrDefault "dir" "./build/"

这将查找要传递的dir参数,并在已分配的情况下使用它,否则它将默认为./build/

That will look for the dir parameter being passed in, and use it if it's assigned, otherwise it will default to ./build/

这篇关于我可以将参数传递给F#FAKE构建脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆