Setting up a simple class library to build and publish to VSTS's own feed, I see this error when the NuGet package runs.
Could not find version number data in BUILD_BUILDNUMBER
I have the "Use Build number to version package" option ticked. Expected VSTS to just work.
$(Build. SourcesDirectory) : The local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s By default, new build definitions update only the changed files. You can modify how files are downloaded on the Repository tab.
Build numbers in Azure DevOps For example, Microsoft's Build Number format documentation gives an example: $(TeamProject)_$(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:. r) will result in a version number like Fabrikam_CIBuild_main_20090805.
Build.ArtifactStagingDirectory. The local path on the agent where any artifacts are copied to before being pushed to their destination. For example: c:\agent_work\1\a. A typical way to use this folder is to publish your build artifacts with the Copy files and Publish build artifacts tasks. Note: Build.
The tip for "Use Build number to version package" states:
Will use the build number to version you package. Under General set the build format to be '
$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
'
Following this did get me past this issue (and on to a new one).
Default value:
[]
Correct Value:
[]
This is because your build number does not match the regex in "Nuget Packager" step. Following is the regex that nuget packager task used to find the build number. You can set your build number format base on this. General, the format like 1.2.3 or 1.2.3.4 would work.
Write-Verbose "Autoversion: Getting version number from build"
##Get Version from Build
# Regular expression pattern to find the version in the build number
# and then apply it to the assemblies
$VersionRegex = "\d+\.\d+\.\d+(?:\.\d+)?"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With