Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>BuildNum
BuildNum

BuildNum

JJ van Zon

|
3 installs
| (0) | Free
Finds BuildNum.xml | Reads BuildNum element | Offers $(BuildNum) variable
Get it free

BuildNum

Azure Pipelines task that:

  • Finds BuildNum.xml
  • Reads the BuildNum element
  • Stores it in the $(BuildNum) variable

It has no parameters, only the output $(BuildNum) variable, so you can just drop it in and use it.
Intended for use with the JJ.AutoIncrementVersion nuget package for auto-incremental version numbers in .NET.

Goal

You could use $(BuildNum) at your own whim.

But the main thing this Task solves, is to keep $(BuildNum) constant during the solution build. MSBuild might start incrementing BuildNum multiple times, as multiple projects build one by one or even in parallel.

By passing $(BuildNum) to the MSBuild Task you can mitigate the problem. Fill this out under MSBuild Arguments:

/p:BuildNum=$(BuildNum)

This prevents the build from incrementing BuildNum multiple times.

Screen shot of Azure DevOps classic pipeline GUI using BuildNum and MSBuild tasks. Arrow points to MSBuild task field with /p:BuildNum=$(BuildNum)

Alternative

If you need something more specific, I recommend the Set variable with value from XML task by Yod Labs. Using these parameters accomplishes something similar:

Variable Name    : BuildNum
XPath expression : //BuildNum
XML file path    : BuildNum.xml

Set variable with value from XML might not recursively search for the BuildNum.xml but uses a literal path. BuildNum searches recursively and has no parameterization burden, working out of the box with the JJ.AutoIncrementVersion nuget package.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft