vsts-assemblyinfo-task
vsts-assemblyinfo-task copied to clipboard
Build tag was not added successfully
variables:
- name: appVersion
value: '#.#.*.*'
stages:
- stage: build
displayName: Build
condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI')))
variables:
solutionPath: sln/path
jobs:
- job: build_solution
displayName: Build, Test and Publish (Artifacts)
steps:
- checkout: self
submodules: true
# other tasks...
- task: Assembly-Info-NetCore@3
displayName: 'Set Assembly Metadata'
inputs:
Path: '$(solutionPath)'
FileNames: '**/*.csproj'
InsertAttributes: true
FileEncoding: 'iso-8859-2'
WriteBOM: false
PackageVersion: '$(appVersion)'
LogLevel: 'verbose'
FailOnWarning: true
UpdateBuildNumber: '$(Build.DefinitionName)_v$(appVersion)'
AddBuildTag: 'v$(appVersion)'
Causes the following error: ##[error]Build tag 'v#.#.8798.27461' was not added successfully.
Starting: Set Assembly Metadata
==============================================================================
Task : Assembly Info (.Net Core & .Net Standard)
Description : Set assembly or package information such as Version, Copyright and Repository URL's etc.
Version : 3.3.0
Author : Bleddyn Richards
Help : [More Information](https://marketplace.visualstudio.com/items?itemName=bleddynrichards.Assembly-Info-Task)
==============================================================================
Task Parameters...
Setting .Net Core / .Net Standard assembly info...
Processing: D:\a\1\s\src\sln\path\project\Project.csproj
Detected file encoding: iso-8859-2
Version --> 1.4.8798.27461
Verify file encoding: iso-8859-2
Setting output variables...
$.AssemblyInfo.Version:
$.AssemblyInfo.FileVersion:
$.AssemblyInfo.InformationalVersion:
$.AssemblyInfo.PackageVersion: 1.4.8798.27461
Updating build...
Renamed Build: Project_v#.#.8798.27461
Added Tag: v#.#.8798.27461
Async Command Start: Update Build Number
Update build number to Project_v#.#.8798.27461 for build 1409
Async Command End: Update Build Number
Async Command Start: Add Build Tag
Async Command End: Add Build Tag
##[error]Build tag 'v#.#.8798.27461' was not added successfully.
Finishing: Set Assembly Metadata
The tag becomes just v
However commenting out UpdateBuildNumber
and AddBuildTag
all works well and version number is set correctly to 1.4.8798.27461
# UpdateBuildNumber: '$(Build.DefinitionName)_v$(appVersion)'
# AddBuildTag: 'v$(appVersion)'
I guess this is due to the Major and Minor version numbers 1.4 are within the csproj and not captured and used in the build tagging and therefore just keeps the #.# in the build name and tag?
Yeah updating yml pipeline to this works fine, so I guess build tagging also need to support #
to keep part of version number
UpdateBuildNumber: '$(Build.DefinitionName)_v1.4.*.*'
AddBuildTag: 'v1.4.*.*'