Lawrence
Lawrence

Reputation: 3307

Specifying build parameters to FAKE

I am essentially asking for an update to date answer to the already answered question: Can I pass a parameter to a F# FAKE build script?

Here is build.fsx

let revisionNumber  = getBuildParamOrDefault "rev" "123"

Target "Log" (fun _ -> 
    trace ("Revision Number: " + revisionNumber)
)

RunTargetOrDefault "Log"

Output running Fake.exe .\build.fsx:

enter image description here

Perfect!

Output running Fake.exe .\build.fsx rev=456 (as suggested by this answer: https://stackoverflow.com/a/26597179/2382536):

Starts with

enter image description here

But at the bottom gives the correct result:

enter image description here

What format do I need to pass the parameters in to get rid of the warning message?

Upvotes: 0

Views: 684

Answers (2)

Jürgen Steinblock
Jürgen Steinblock

Reputation: 31743

I just want to share the link to the official documentation:

TLDR:

You can either use

--envvar [-ev] <name:string> <value:string>

to set a variable to a custom value, or

--envflag [-ef] <name:string>

to set a variable to true, or

--fsiargs --debug+ buildscript.fsx someArg1 anotherArg2

to pass all arguments (including build script name, importent!) direcly to fsi.exe

Upvotes: 1

Alexey Zimarev
Alexey Zimarev

Reputation: 19640

Passing parameters is done using the --envvar parameter. Until recently you can just add parameters in a way you did after the build target but not anymore. I believe this was changed in order not to confuse build parameters with (optional) build target name.

So, try this:

fake build.fsx Push --envvar rev 456

Upvotes: 1

Related Questions