代码之家  ›  专栏  ›  技术社区  ›  Imran Sh

无法将NuGet包发布到Azure DevOps工件中同一组织中的提要

  •  0
  • Imran Sh  · 技术社区  · 7 月前

    我有一个提要和一个管道,我想基于这种方法发布我的工件:

    steps:
    - task: NuGetToolInstaller@1                            # Minimum required NuGet version: 4.8.0.5385+.
      displayName: 'NuGet Tool Installer'
    
    - task: NuGetAuthenticate@1
      displayName: 'NuGet Authenticate'
    
    - script: |
          nuget.exe push -Source "https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json" -ApiKey az $(Build.ArtifactStagingDirectory)\*.nupkg
      displayName: Push
    

    订阅源权限设置如下:

    Feed Permissions

    前两步会通过,但不会通过最后一步!

    第二个任务的结果:

    Starting: NuGet Authenticate
    ==============================================================================
    Task         : NuGet authenticate
    Description  : Configure NuGet tools to authenticate with Azure Artifacts and other NuGet repositories. Requires NuGet >= 4.8.5385, dotnet >= 6, or MSBuild >= 15.8.166.59604
    Version      : 1.247.4
    Author       : Microsoft Corporation
    Help         : https://aka.ms/NuGetAuthenticateTask
    ==============================================================================
    Installing the Azure Artifacts Credential Provider (.NET Framework) to '/home/vsts/.nuget/plugins/netfx/CredentialProvider.Microsoft'. This credential provider is compatible with nuget.exe 4.8.0.5385 or later, and MSBuild 15.8.166.59604 or later.
    
    Installing the Azure Artifacts Credential Provider (.NET Core) to '/home/vsts/.nuget/plugins/netcore/CredentialProvider.Microsoft'. This credential provider is compatible with .NET SDK 6 or later.
    
    Setting up the credential provider to use the identity '($$Project$$) Build Service ($$ORG$$)' for feeds in your organization/collection starting with:
      https://pkgs.dev.azure.com/($$ORG$$)/
      https://($$ORG$$).pkgs.visualstudio.com/
    
    Finishing: NuGet Authenticate
    
    

    最后是最后一步的结果:

    Starting: Push
    ==============================================================================
    Task         : Command line
    Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
    Version      : 2.246.1
    Author       : Microsoft Corporation
    Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
    ==============================================================================
    Generating script.
    Script contents:
    nuget.exe push -Source "https://pkgs.dev.azure.com/($$ORG$$)/($$Project$$)/_packaging/($$FeedName$$)/nuget/v3/index.json" -ApiKey az /home/vsts/work/1/a\*.nupkg
    ========================== Starting Command Output ===========================
    /usr/bin/bash --noprofile --norc /home/vsts/work/_temp/304f2fc5-6e26-4112-ba5a-c1a70f9723cd.sh
    /home/vsts/work/_temp/304f2fc5-6e26-4112-ba5a-c1a70f9723cd.sh: line 1: /opt/hostedtoolcache/NuGet/6.12.2/x64/nuget.exe: Permission denied
    
    ##[error]Bash exited with code '126'.
    Finishing: Push
    

    我尝试了这种方法: Set Permission

    1 回复  |  直到 7 月前
        1
  •  1
  •   bryanbcook    7 月前

    使用 NuGetCommand@2 要推送包裹,请执行以下操作:

    - task: NuGetCommand@2
      inputs:
        command: push
        packagesToPush: $(Build.ArtifactStagingDirectory)\*.nupkg
        nugetFeedType: internal
        publishVstsFeed: yourFeedName
    
    推荐文章