我希望 Nuget 包的版本号能够随着推送到 Artifacts 商店的每个版本而递增并且易于人类读取。这是我的 yaml。
variables:
feedName : 'MyNugets'
buildConfiguration: 'release'
name: $(Year:yyyy).$(Month).$(DayOfMonth).$(Rev:.r)
pool:
vmImage: windows-latest
steps:
- task: DotNetCoreCLI@2
displayName: 'Build'
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Pack'
inputs:
command: pack
versioningScheme: byBuildNumber
- task: NuGetAuthenticate@1
displayName: 'NuGet Authenticate'
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
publishVstsFeed: '$(feedName)'
allowPackageConflicts: true
我可以在 SO 或其他谷歌结果上找到任何建议。他们似乎都不起作用。我总是遇到这个错误。
##[error]Could not find version number data in the following environment variable: BUILD_BUILDNUMBER. The value of the variable should contain a substring with the following formats: X.Y.Z or X.Y.Z.A where A, X, Y, and Z are positive integers.
有什么建议吗?
不要将名称存储在变量中,而是放在上面的单独部分中
variables
。
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
variables:
feedName : 'MyNugets'
buildConfiguration: 'release'