Setting a parameter before a build feature is executed

Hello,

I've started testing TeamCity and I'm trying to understand if it's possible to set a custom parameter for a build before any build feature is executed.

I need to set the <Version> tag in the .csproj files of my build using a custom format, like MAJOR.MINOR.MMDD.0 and I've created an env.MMDD parameter that is set by the first build step by running a Powershell script:

echo "##teamcity[setParameter name='env.MMDD' value='$([DateTime]::Now.ToString("MMdd"))']"

I also use the File Content Replacer feature to update the Version tags, but the env.MMDD is always empty when the feature is executed, since it runs before the first build step. I've tried to see if there are options to change this behaviour, but I haven't found any. 

Do you have any suggestions?

Thanks

Sergio

0
1 comment

Hi Sergio,

Have you considered using a bootstrap step to do the initial setup of the parameter right after the build is triggered? The following section of the documentation explains more about it and how to set it up:

https://www.jetbrains.com/help/teamcity/configuring-build-steps.html#Bootstrap+Steps

Thanks,

Guilherme

0

Please sign in to leave a comment.