Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Set Build Number

Sets (changes) the build number of the currently executing build.

Script usage:

Set-BuildNumber <text>;

This operation may be prefixed with Core::, although this is a built-in namespace and isn't really necessary.

Arguments:

NameFormatScript UsageUsage Notes
New build number (default)
text
BuildNumber
This argument is required.

Build Number in Context: This operation will do two things: change the BuildNumber in the database and create a runtime variable named $BuildNumber with the new build number. However, it will *not* update the execution context with the new BuildNumber; this means that, for some operations that rely on the BuildNumber in context (instead of looking up the BuildNumber based on the BuildId), this will likely result in a "build not found" or such error. To resolve this, explicitly pass in $BuildNumber as an argument. For example, if you create an artifact after setting the BuildNumber, explicitly pass in the BuildNumber.

Example:


# The build.xml file contains a project version we wish to show users in the build number
PSCall GLOBAL::ExtractProjectVersion
(
    buildFilePath: $WorkingDirectory\build.xml,
    OutputArg => $ProjectVersionTemp
);

# This will update the build number
Set-BuildNumber $ExtractProjectVersion.$BuildNumber;