0

Description

In TeamCity, I set the {my project} > General Settings > Build number format to the parameter %build.number%. Apparently TeamCity cannot resolve this parameter and I get #??? as my build number and also the warning message below:

Parameter "build.number=%build.number%" is not fully resolved, using as is.

enter image description here

Question

How can I use this parameter? Is there any special settings for that?

Basically I need the version of my project as my build number

A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128
  • 1
    I think you've misunderstood something here. `%build.number%` is the contents of the field you're editing there. Basically you've said "the contents of this field should be the contents of this field". No wonder TeamCity is confused. You say you want the "version of my project"? How will TeamCity figure that out? Is it the version control changeset number? If so then type in `%vcs` and wait for "intellisense" to give you the options. If you want a simple continuous number, use `%build.counter%`. – Lasse V. Karlsen May 14 '16 at 18:02
  • What **exactly** do you mean by "version of my project"? – Lasse V. Karlsen May 14 '16 at 18:03
  • @LasseV.Karlsen In our other projects in the TeamCity I see we have `Build number format = %build.number%`. Every time I build those other projects a number of this format `example: 1.0.9.12` appears under the project name (this is the version of the project, the forth part of the version is the build counter. – A-Sharabiani May 14 '16 at 18:09
  • Where did it get 1.0.9 from? – Lasse V. Karlsen May 14 '16 at 18:18
  • @LasseV.Karlsen not entirely sure but I thought it is somehow getting it from the %build.number% parameter. – A-Sharabiani May 14 '16 at 18:21
  • Does any of these other projects output a `##teamcity[buildNumber '1.0.9.12']` message as part of the build? Or something like `##teamcity[buildNumber '1.0.9.%build.counter%']` ? – Lasse V. Karlsen May 14 '16 at 18:22
  • No but I figured in the last build step, they run a bash script from a file, which stored the current and previous version of the project. – A-Sharabiani May 14 '16 at 18:37

1 Answers1

2

The name of that field is "build.number".

Hence, you've said that the value of "build.number" should be the value of "build.number". TeamCity is thus rightly confused.

You can use %build.number% in the various build steps for a build configuration to refer to this field but when you're defining that field, you must use something else.

Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
  • I've set the `Build number format` to `%build.number%`. And `%build.number%` is a predefined parameter. – A-Sharabiani May 14 '16 at 18:14
  • And you simply cannot do that. You have a recursive definition, "the value of build.number is the value of build.number", this won't work. It isn't predefined when *you're defining it*. You've done the same as `int x = x;` in C/C++/Java/C# lingo. – Lasse V. Karlsen May 14 '16 at 18:21
  • What should I set it's value to have the version number ? (I want build.number to be 1.0.9.8 for example `[version].%build.counter%` – A-Sharabiani May 14 '16 at 18:44
  • That depends entirely on where "1.0.9" comes from. Do you want to set this using TeamCity or does it come from somewhere else? – Lasse V. Karlsen May 14 '16 at 19:04