1
votes

In TeamCity you can specify build parameters which can then be accessed by MSBuild. I currently use this feature to distinguish between deployment environment targets using a system parameter called DeployTo. I thought this would be accessible through Fake.EnvironmentHelper but when I print environVar "DeployTo" there is nothing there. I have also tried listing environVars EnvironmentVariableTarget.Machine but it is not listed there either.

I have tried passing it in as a command-line argument like so:

build.fsx Deploy --envvar DeployTo Test

or

build.fsx Deploy -ev DeployTo Test

However, instead of passing "Test", the environment variable is set to "true"

Is there any way to access a TeamCity build parameter from a FAKE build script?

2

2 Answers

2
votes

In order to see parameter as environment variable, you must define it with prefix env..

If you define a parameter env.DeployTo with value Test, it will be accessible to the build as environmental variable DeployTo

0
votes

It looks like the only way to do it is through the command line. I had the wrong syntax, the correct syntax would be:

build.fsx DeployTo=test