Reputation: 91
In VSTS, how can I access build variables in a F# task/script?
Stuart
Upvotes: 1
Views: 197
Reputation: 33728
Just access the environment variable or pass the variable value as parameter.
For example, print the value of build definition name and custom variable.
open System
[<EntryPoint>]
printfn "%A" (Environment.GetEnvironmentVariable("BUILD_DEFINITIONNAME"))
printfn "%A" (Environment.GetEnvironmentVariable("MyVar"))
let main args =
printfn "%A" (Environment.GetEnvironmentVariable("t"))
Note: Tested with Execute F# Script task in F# Helpers extension.
Upvotes: 1