我收到一个错误:
User XXX lacks permission to complete this action. You need to have 'AddPackage'
尝试将 nuget 包推送到 Azure DevOps 工件时。我是管理员 这是阶段:
  - stage:
    displayName: 'Release'
    condition: succeeded()
    jobs:
      - job: 'Publish'
        displayName: 'Publish nuGet Package'
        steps:
          - download: current
            artifact: $(PIPELINE_ARTIFACT_NAME)
            displayName: 'Download pipeline artifact'
          - script: ls $(PATH_PIPELINE_ARTIFACT_NAME)
            displayName: 'Display contents of downloaded articacts path'
          - task: NuGetAuthenticate@0
            displayName: 'Authenticate in NuGet feed'
          - script: dotnet nuget push $(PATH_PIPELINE_ARTIFACT_NAME)/**/*.nupkg --source $(NUGET_FEED) --api-key $(NUGET_API_KEY)
            displayName: 'Uploads nuGet packages'
和确切的错误:
error: …我有一个内部版本号格式“ $(BuildDefinitionName)-$(Rev:.r)”,可以将其放入可视设计器选项中,并且效果很好。但是,现在我想开始使用新的YAML构建管道,但是我无法弄清楚如何将这种自定义内部版本号格式与“替换令牌”任务一起使用。
我使用下面的 yaml 来生成我的 NuGet pkg。我想为我的包裹提供一个带有日期的唯一 ID。但我不断收到错误消息,说在以下环境变量中找不到版本号数据:BUILD_BUILDNUMBER
##[错误]在以下环境变量中找不到版本号数据:BUILD_BUILDNUMBER。变量的值应包含一个带有或为正整数的子字符串。
我尝试使用 name: $(Build.DefinitionName)-$(date:yyyyMMdd)$(rev:.r)# 需要这个用于byBuildNumberverisonScheme nuget 包。
还尝试BUILD_BUILDNUMBER在 yaml 文件中设置为变量。
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
name: $(Build.DefinitionName)-$(date:yyyyMMdd)$(rev:.r) # need this for byBuildNumber verisonScheme nuget pack
# the build will trigger on any changes to the master branch
trigger:
- master
# the build will run on …nuget azure-devops azure-pipelines-build-task azure-pipelines
是否可以在用于包创建的 .nuspec 文件中使用 Azure DevOps 管道变量?
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata>
    <id>MyTemplate</id>
    <version>$(var1).$(var2).$(var3)</version>
    <description>
      Some template
    </description>
    <authors>Test Test</authors>
    <packageTypes>
      <packageType name="Template" />
    </packageTypes>
  </metadata>
</package>
或者它是 .yaml 任务中那些在 .nuspec 文件(它是必需元素)中指定的版本的一种方法吗?
task: NuGetCommand@2
  displayName: Pack template
  inputs:
    command: pack
    packagesToPack: '**/Template/*.nuspec'
    packDestination: $(Build.ArtifactStagingDirectory)
    versioningScheme: byPrereleaseNumber
    majorVersion: '$(var1)'
    minorVersion: '$(var2)'
    patchVersion: '$(var3)'
但是使用 versioningScheme: byPrereleaseNumber 我们会将时间戳添加到我们的数字中。
运行.Net核心任务到打包.如何将输出的nuget包版本提供给Auto Increment本身,格式为:
1.0.0
所以下次我打包/推送时我想看1.0.1
我正在使用Build.BuildNumber的环境构建变量并在以下时刻获取输出:
20180913-.2.0等想要纠正更传统的版本控制系统
谢谢.
azure-devops azure-pipelines-build-task azure-pipelines azure-artifacts