Manually incrementing the %build.counter% DURING a build

This counter gets incremented at the start of every build. I would also like to increment it as a step in the
middle of the build. The result is that every time a build occurs, this counter ends up +2 from where it was before. I know that the build.number can be overrridden during the build process, but I ca
nnot find a way to override the build.counter. Can someone help me with this? Thanks!

Comment actions Permalink

Hi Jason,
You can change build.counter via REST API request (expand example at the end of section).
BTW, could you please describe why do you need to increase counter by two?

Comment actions Permalink

Thanks for the reply,

The incrementing was due to a single build doing both a Debug and Release version, both of which are producing NuGet packages, and wanting to have a unique version number for Debug vs Build. The solution I ended up taking was to split this into three projects -- one for CI, one for the Debug packaging, and one for the Release packaging. The two packaging projects now share a single build counter using the optional autoincrement counter plugin, and the build number for the CI build no longer matters.


Please sign in to leave a comment.