admin管理员组

文章数量:1126099

I have a feed and a pipeline which I want to publish my artifacts based on this approach:

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 "/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json" -ApiKey az $(Build.ArtifactStagingDirectory)\*.nupkg
  displayName: Push

The feed permissions are set as bellow:

The first two steps will be passed, but not the last one!

Result of second task:

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         : 
==============================================================================
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:
  /($$ORG$$)/
  https://($$ORG$$).pkgs.visualstudio/

Finishing: NuGet Authenticate

And finally the result of last step:

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         : 
==============================================================================
Generating script.
Script contents:
nuget.exe push -Source "/($$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

I tried this approach: Set Permission

I have a feed and a pipeline which I want to publish my artifacts based on this approach:

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

The feed permissions are set as bellow:

The first two steps will be passed, but not the last one!

Result of second task:

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

And finally the result of last step:

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

I tried this approach: Set Permission

Share Improve this question asked 2 days ago Imran ShImran Sh 1,7744 gold badges30 silver badges54 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Use the NuGetCommand@2 to push the packages:

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

本文标签: Unable to publish NuGet packages to a feed in the same organization in Azure DevOps ArtifactStack Overflow