TeamCity and wrong build.vcs.number.<vcs_id>

I'm using the build.vcs.number. for versioning of my assemblies. However, last days I'm receiving the compilation error message:

"error CS0647: Error emitting 'System.Reflection.AssemblyVersionAttribute' attribute -- 'The version specified '3.2.0.66237' is invalid' "

I know there is a limitation of the assembly number to 65535. Is there a way to reset the counter or fix this issue in any way? I've tried to recreate the VCS in TeamCity but error still appears.

Thanks!

1 comment
Comment actions Permalink

build.vcs.number returns the latest revision for the change you are currently building from the selected VCS root. Therefore it is not possible to reset this value as it is vital to the integritiy of your VCS. Which looks to be SVN?

We had a similar issue. May I ask why you decided to use the VCS revision as part of your version number?

We ended up abandoning this approach and started using TeamCity's build.counter as the final build number and then for our own informational purposes we added an entry into the Assembly information version attribute.

Depending on where you get the 3.2.0 portion of your revision from a fairly common suggestion is the following:

  1. Change your "Build number format" under "General Settings" of your build configuration to 3.2.0.%build.counter%
  2. Change the configuration of your "AassemblyInfo patcher" build feature to:
    • Assembly version formation: %build.number%
    • Assembly informational version format: %build.number% (Revision: %build.vcs.number.<vcs_id>%)


The benefit to this is you can reset the build counter if you choose to and you will still get to see the VCS revision used for a given build in the informational version attribute.

Also for the "Assembly information version format" to work the attribute has to already exist in your AssemblyInfo file. The AssemblyInfo patcher will only change the value if the attribute already exists, it won't add the attribute.

Hope this helps! :)

0

Please sign in to leave a comment.