我有一个提要和一个管道,我想根据这种方法发布我的工件:
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
提要权限设置如下:
前两步会通过,但最后一步不会!
第二个任务的结果:
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
我尝试过这种方法: 设置权限
使用
NuGetCommand@2
推送包裹:
- task: NuGetCommand@2
inputs:
command: push
packagesToPush: $(Build.ArtifactStagingDirectory)\*.nupkg
nugetFeedType: internal
publishVstsFeed: yourFeedName