'Azure DevOps publish Nuget to hosted feed
I have a question using the hosted (free) AzureDevops pipelines. I have a small .NET Core project which I want to create an Azure Devops pipeline where the following is done
- restore
- build
- pack
- push (to AzureDevOps hosted artifact feed)
I have the following feed setup on my project in Azure Devops
Which has this connection information for the feed
..../NugetProjects/_packaging/nugetprojectstestfeed/nuget/v3/index.json
It also has the following security applied to it (note the Project Collection Build Service is set as "Contributor")
Which is as stated from this paragraph from Microsoft official docs
To publish to an Azure Artifacts feed, set the Project Collection Build Service identity to be a Contributor on the feed.
I then have this build pipeline setup (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
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
Major: '1'
Minor: '0'
Patch: '0'
steps:
- task: DotNetCoreCLI@2
displayName: 'Restore'
inputs:
command: restore
projects: '**/MathsLib.csproj'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: '**/MathsLib.csproj'
arguments: '--configuration Release' # Update this to match your need
- task: DotNetCoreCLI@2
inputs:
command: 'pack'
projects: '**/MathsLib.csproj'
outputDir: '$(Build.ArtifactStagingDirectory)'
versioningScheme: 'byPrereleaseNumber'
majorVersion: '1'
minorVersion: '0'
patchVersion: '0'
- task: NuGetAuthenticate@0
displayName: 'NuGet Authenticate'
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
publishVstsFeed: 'nugetprojectstestfeed'
allowPackageConflicts: true
The entire pipeline works fine up until the Nuget push. As shown here
But if I look into the exception I see this sort of thing
##[warning]Could not create provenance session: {"statusCode":500,"result":{"$id":"1","innerException":null,"message":"The feed with ID 'nugetprojectstestfeed' doesn't exist.","typeName":"Microsoft.VisualStudio.Services.Feed.WebApi.FeedIdNotFoundException, Microsoft.VisualStudio.Services.Feed.WebApi","typeKey":"FeedIdNotFoundException","errorCode":0,"eventId":3000}}
[command]/usr/bin/mono /opt/hostedtoolcache/NuGet/4.1.0/x64/nuget.exe push /home/vsts/work/1/a/MathsLib.1.0.0-CI-20191114-115941.nupkg -NonInteractive -Source https://pkgs.dev.azure.com/XXXXX/_packaging/nugetprojectstestfeed/nuget/v3/index.json -ApiKey VSTS -Verbosity Detailed
System.AggregateException: One or more errors occurred. (Unable to load the service index for source https://pkgs.dev.azure.com/XXXXX/_packaging/nugetprojectstestfeed/nuget/v3/index.json.) ---> NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://pkgs.dev.azure.com/XXXXX/_packaging/nugetprojectstestfeed/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found - The feed with ID 'nugetprojectstestfeed' doesn't exist. (DevOps Activity ID: F123AC3A-8E75-4D3A-B3B6-60EC4510FF54)).
This was my original feed connection
https://pkgs.dev.azure.com/XXXX/NugetProjects/_packaging/nugetprojectstestfeed/nuget/v3/index.json
But this is what is shown in the error message
https://pkgs.dev.azure.com/XXXXX/_packaging/nugetprojectstestfeed/nuget/v3/index.json
So it looks like its trying to access a feed in some root project, not the "NuGetProjects" project that I have setup in Azure DevOps. Is there some setting/config that I am missing to tell it to target the feed inside the "NuGetProjects" project
As I say it looks like its looking for some top level feed not inside the specific project for which the build pipeline is setup for
Full step by step of using a new feed
So for completeness here is a full run down of how I created the project the feed and where it sits in the organisation of things (I have created a new feed as suggested as something to try)
I have this organisation "sachabarber2019", which has these projects in it
I have then created this feed in one of the projects of the organisation
And this is current build pipeline
# 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
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
Major: '1'
Minor: '0'
Patch: '0'
steps:
- task: DotNetCoreCLI@2
displayName: 'Restore'
inputs:
command: restore
projects: '**/MathsLib.csproj'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: '**/MathsLib.csproj'
arguments: '--configuration Release' # Update this to match your need
- task: DotNetCoreCLI@2
inputs:
command: 'pack'
projects: '**/MathsLib.csproj'
outputDir: '$(Build.ArtifactStagingDirectory)'
versioningScheme: 'byPrereleaseNumber'
majorVersion: '1'
minorVersion: '0'
patchVersion: '0'
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
feedsToUse: select
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
vstsFeed: anotherfeed
nuGetFeedType: internal
publishVstsFeed: anotherfeed
allowPackageConflicts: true
And as before I get the same error
##[section]Starting: NuGet push
==============================================================================
Task : NuGet
Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
Version : 2.161.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/nuget
==============================================================================
Caching tool: NuGet 4.1.0 x64
Found tool in cache: NuGet 4.1.0 x64
Resolved from tool cache: 4.1.0
Using version: 4.1.0
Found tool in cache: NuGet 4.1.0 x64
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
Detected NuGet version 4.1.0.2450 / 4.1.0
##[warning]Could not create provenance session: {"statusCode":500,"result":{"$id":"1","innerException":null,"message":"The feed with ID 'anotherfeed' doesn't exist.","typeName":"Microsoft.VisualStudio.Services.Feed.WebApi.FeedIdNotFoundException, Microsoft.VisualStudio.Services.Feed.WebApi","typeKey":"FeedIdNotFoundException","errorCode":0,"eventId":3000}}
[command]/usr/bin/mono /opt/hostedtoolcache/NuGet/4.1.0/x64/nuget.exe push /home/vsts/work/1/a/MathsLib.1.0.0-CI-20191120-121118.nupkg -NonInteractive -Source https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json -ApiKey VSTS -Verbosity Detailed
NuGet Version: 4.1.0.2450
mono-sgen: /home/vsts/work/_tasks/NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b/2.161.0/CredentialProvider/CredentialProvider.TeamBuild.exe -uri https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json -nonInteractive -verbosity detailed
mono-sgen: URI Prefixes:
mono-sgen: https://dev.azure.com/sachabarber2019/
mono-sgen: https://pkgs.dev.azure.com/sachabarber2019/
mono-sgen: https://pkgsproduks1.pkgs.visualstudio.com/
mono-sgen: https://pkgs.dev.azure.com/sachabarber2019/
mono-sgen: https://sachabarber2019.pkgs.visualstudio.com/
mono-sgen: https://pkgs.dev.azure.com/sachabarber2019/
mono-sgen: URI: https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json
mono-sgen: Is retry: False
mono-sgen: Matched prefix: https://pkgs.dev.azure.com/sachabarber2019/
System.AggregateException: One or more errors occurred. (Unable to load the service index for source https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json.) ---> NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found - The feed with ID 'anotherfeed' doesn't exist. (DevOps Activity ID: 9E8C7E28-9D51-44A1-9286-8F6F839BCBD6)).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x00040] in <7ecf813f2d314058b05c6c092c47b77a>:0
at NuGet.Protocol.HttpSource+<>c__DisplayClass12_0`1[T].<GetAsync>b__0 (System.Threading.CancellationToken lockedToken) [0x004a8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T] (System.String filePath, System.Func`2[T,TResult] action, System.Threading.CancellationToken token) [0x0024a] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.HttpSource.GetAsync[T] (NuGet.Protocol.HttpSourceCachedRequest request, System.Func`2[T,TResult] processAsync, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x000ed] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3 (NuGet.Protocol.Core.Types.SourceRepository source, System.DateTime utcNow, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x00207] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of inner exception stack trace ---
at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3 (NuGet.Protocol.Core.Types.SourceRepository source, System.DateTime utcNow, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x002d5] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.ServiceIndexResourceV3Provider.TryCreate (NuGet.Protocol.Core.Types.SourceRepository source, System.Threading.CancellationToken token) [0x00233] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] (System.Threading.CancellationToken token) [0x000b8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.PackageUpdateResourceV3Provider.TryCreate (NuGet.Protocol.Core.Types.SourceRepository source, System.Threading.CancellationToken token) [0x0007d] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] (System.Threading.CancellationToken token) [0x000b8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] () [0x0006e] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Commands.CommandRunnerUtility.GetPackageUpdateResource (NuGet.Configuration.IPackageSourceProvider sourceProvider, System.String source) [0x000f1] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Commands.PushRunner.Run (NuGet.Configuration.ISettings settings, NuGet.Configuration.IPackageSourceProvider sourceProvider, System.String packagePath, System.String source, System.String apiKey, System.String symbolSource, System.String symbolApiKey, System.Int32 timeoutSeconds, System.Boolean disableBuffering, System.Boolean noSymbols, NuGet.Common.ILogger logger) [0x00133] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.CommandLine.PushCommand.ExecuteCommandAsync () [0x001b0] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <285579f54af44a2ca048dad6be20e190>:0
at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <285579f54af44a2ca048dad6be20e190>:0
at System.Threading.Tasks.Task.Wait () [0x00000] in <285579f54af44a2ca048dad6be20e190>:0
at NuGet.CommandLine.Command.Execute () [0x000bd] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) [0x001f3] in <d0f788a4af354971807e5d8ca6fc682e>:0
---> (Inner Exception #0) NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found - The feed with ID 'anotherfeed' doesn't exist. (DevOps Activity ID: 9E8C7E28-9D51-44A1-9286-8F6F839BCBD6)).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x00040] in <7ecf813f2d314058b05c6c092c47b77a>:0
at NuGet.Protocol.HttpSource+<>c__DisplayClass12_0`1[T].<GetAsync>b__0 (System.Threading.CancellationToken lockedToken) [0x004a8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T] (System.String filePath, System.Func`2[T,TResult] action, System.Threading.CancellationToken token) [0x0024a] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.HttpSource.GetAsync[T] (NuGet.Protocol.HttpSourceCachedRequest request, System.Func`2[T,TResult] processAsync, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x000ed] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3 (NuGet.Protocol.Core.Types.SourceRepository source, System.DateTime utcNow, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x00207] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of inner exception stack trace ---
at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3 (NuGet.Protocol.Core.Types.SourceRepository source, System.DateTime utcNow, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x002d5] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.ServiceIndexResourceV3Provider.TryCreate (NuGet.Protocol.Core.Types.SourceRepository source, System.Threading.CancellationToken token) [0x00233] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] (System.Threading.CancellationToken token) [0x000b8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.PackageUpdateResourceV3Provider.TryCreate (NuGet.Protocol.Core.Types.SourceRepository source, System.Threading.CancellationToken token) [0x0007d] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] (System.Threading.CancellationToken token) [0x000b8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] () [0x0006e] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Commands.CommandRunnerUtility.GetPackageUpdateResource (NuGet.Configuration.IPackageSourceProvider sourceProvider, System.String source) [0x000f1] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Commands.PushRunner.Run (NuGet.Configuration.ISettings settings, NuGet.Configuration.IPackageSourceProvider sourceProvider, System.String packagePath, System.String source, System.String apiKey, System.String symbolSource, System.String symbolApiKey, System.Int32 timeoutSeconds, System.Boolean disableBuffering, System.Boolean noSymbols, NuGet.Common.ILogger logger) [0x00133] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.CommandLine.PushCommand.ExecuteCommandAsync () [0x001b0] in <d0f788a4af354971807e5d8ca6fc682e>:0 <---
##[error]The nuget command failed with exit code(1) and error(System.AggregateException: One or more errors occurred. (Unable to load the service index for source https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json.) ---> NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found - The feed with ID 'anotherfeed' doesn't exist. (DevOps Activity ID: 9E8C7E28-9D51-44A1-9286-8F6F839BCBD6)).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x00040] in <7ecf813f2d314058b05c6c092c47b77a>:0
at NuGet.Protocol.HttpSource+<>c__DisplayClass12_0`1[T].<GetAsync>b__0 (System.Threading.CancellationToken lockedToken) [0x004a8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T] (System.String filePath, System.Func`2[T,TResult] action, System.Threading.CancellationToken token) [0x0024a] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.HttpSource.GetAsync[T] (NuGet.Protocol.HttpSourceCachedRequest request, System.Func`2[T,TResult] processAsync, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x000ed] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3 (NuGet.Protocol.Core.Types.SourceRepository source, System.DateTime utcNow, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x00207] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of inner exception stack trace ---
at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3 (NuGet.Protocol.Core.Types.SourceRepository source, System.DateTime utcNow, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x002d5] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.ServiceIndexResourceV3Provider.TryCreate (NuGet.Protocol.Core.Types.SourceRepository source, System.Threading.CancellationToken token) [0x00233] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] (System.Threading.CancellationToken token) [0x000b8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.PackageUpdateResourceV3Provider.TryCreate (NuGet.Protocol.Core.Types.SourceRepository source, System.Threading.CancellationToken token) [0x0007d] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] (System.Threading.CancellationToken token) [0x000b8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] () [0x0006e] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Commands.CommandRunnerUtility.GetPackageUpdateResource (NuGet.Configuration.IPackageSourceProvider sourceProvider, System.String source) [0x000f1] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Commands.PushRunner.Run (NuGet.Configuration.ISettings settings, NuGet.Configuration.IPackageSourceProvider sourceProvider, System.String packagePath, System.String source, System.String apiKey, System.String symbolSource, System.String symbolApiKey, System.Int32 timeoutSeconds, System.Boolean disableBuffering, System.Boolean noSymbols, NuGet.Common.ILogger logger) [0x00133] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.CommandLine.PushCommand.ExecuteCommandAsync () [0x001b0] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <285579f54af44a2ca048dad6be20e190>:0
at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <285579f54af44a2ca048dad6be20e190>:0
at System.Threading.Tasks.Task.Wait () [0x00000] in <285579f54af44a2ca048dad6be20e190>:0
at NuGet.CommandLine.Command.Execute () [0x000bd] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) [0x001f3] in <d0f788a4af354971807e5d8ca6fc682e>:0
---> (Inner Exception #0) NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://pkgs.dev.azure.com/sachabarber2019/_packaging/anotherfeed/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found - The feed with ID 'anotherfeed' doesn't exist. (DevOps Activity ID: 9E8C7E28-9D51-44A1-9286-8F6F839BCBD6)).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x00040] in <7ecf813f2d314058b05c6c092c47b77a>:0
at NuGet.Protocol.HttpSource+<>c__DisplayClass12_0`1[T].<GetAsync>b__0 (System.Threading.CancellationToken lockedToken) [0x004a8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T] (System.String filePath, System.Func`2[T,TResult] action, System.Threading.CancellationToken token) [0x0024a] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.HttpSource.GetAsync[T] (NuGet.Protocol.HttpSourceCachedRequest request, System.Func`2[T,TResult] processAsync, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x000ed] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3 (NuGet.Protocol.Core.Types.SourceRepository source, System.DateTime utcNow, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x00207] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of inner exception stack trace ---
at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3 (NuGet.Protocol.Core.Types.SourceRepository source, System.DateTime utcNow, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x002d5] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.ServiceIndexResourceV3Provider.TryCreate (NuGet.Protocol.Core.Types.SourceRepository source, System.Threading.CancellationToken token) [0x00233] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] (System.Threading.CancellationToken token) [0x000b8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.PackageUpdateResourceV3Provider.TryCreate (NuGet.Protocol.Core.Types.SourceRepository source, System.Threading.CancellationToken token) [0x0007d] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] (System.Threading.CancellationToken token) [0x000b8] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T] () [0x0006e] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Commands.CommandRunnerUtility.GetPackageUpdateResource (NuGet.Configuration.IPackageSourceProvider sourceProvider, System.String source) [0x000f1] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.Commands.PushRunner.Run (NuGet.Configuration.ISettings settings, NuGet.Configuration.IPackageSourceProvider sourceProvider, System.String packagePath, System.String source, System.String apiKey, System.String symbolSource, System.String symbolApiKey, System.Int32 timeoutSeconds, System.Boolean disableBuffering, System.Boolean noSymbols, NuGet.Common.ILogger logger) [0x00133] in <d0f788a4af354971807e5d8ca6fc682e>:0
at NuGet.CommandLine.PushCommand.ExecuteCommandAsync () [0x001b0] in <d0f788a4af354971807e5d8ca6fc682e>:0 <---)
##[error]Packages failed to publish
##[section]Finishing: NuGet push
Solution 1:[1]
I have found the trouble with this at moment, after 1 hour of checks.
I can see that by default, when you create a Feed over Artifacts on your AzureDevOps project, it's only have permission for Project collection Build Service
but not for your project Build Services
.
Let's check the image below and compare with your Feed Settings.
Going to
Feed Settings/Permission
throughGear Button
on right side of artifacts page
this is the code for my task
- task: NuGetCommand@2
displayName: 'nuget push'
inputs:
command: 'push'
feedsToUse: 'select'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
vstsFeed: kreaCore/kreaCore
publishVstsFeed: kreaCore/kreaCore
versioningScheme: 'off'
allowPackageConflicts: true
And the expected result is
This is a useful tutorial for replicate my test.
Cheers!!
Solution 2:[2]
For project-scoped feeds use publishVsTsFeed: '<yourProjectName>/<yourFeedName>'
In the first example of @sascha the task should look like:
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'NugetProjects/nugetprojectstestfeed'
allowPackageConflicts: true
The package is copied to the feed only if the version number is higher as the package in the feed. Otherwise nuget push will report a conflict, but will pass anyway because of allowPackageConflicts: true
(in contrast to DotNetCoreCLI@2 push)!
Solution 3:[3]
I created a new Azure Artifacts feed a few days ago and ran headlong into this while attempting to create a .NET Core/Standard NuGet build pipeline similar to this example. The rest of my CI pipeline ran perfectly, but the NuGet Push task failed every time with exactly the same error in the Azure Pipelines log, despite all my attempts to find a workaround:
The feed with ID '{my_feed_name}' doesn't exist.
Since the feed did most certainly exist, I dug a bit more and discovered other similar reports of a bug in Azure Pipelines. Apparently, Microsoft recently changed the default scope level for new feeds to Project instead of Organization, which broke several Azure Pipeline tasks. Older feeds don't seem to be affected by this issue. See this forum post:
New feeds are now by default project-scoped and a required fix for the pipeline tasks failed to get deployed. We are pushing out a hotfix to update to the newest pipeline task versions and it should be out by the end of the day.
Hopefully, Microsoft will resolve this issue soon.
Solution 4:[4]
As per the answer from @mwimwi, including the project name in the feed path worked for me:
- task: DotNetCoreCLI@2
displayName: Push
inputs:
command: push
packagesToPush: ...
feedPublish: <project-name>/<feed-name>
Solution 5:[5]
You have missed setting some required arguments in your NuGetCommand@2 task.
Try this:
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
feedsToUse: select
vstsFeed: nugetprojectstestfeed
nuGetFeedType: internal
publishVstsFeed: nugetprojectstestfeed
allowPackageConflicts: true
If we look into the documentation of NuGet task, for 'push' command certain arguments are required.
Solution 6:[6]
I have done two changes like below,
In the FeedSetting Permissions, selected "Allow project-scoped builds"
The YML file updated for NuGetCommand like below,
task: NuGetCommand@2
displayName: 'Publish NuGet package'
inputs:
command: push
feedsToUse: 'select'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'Space Game - web - Dependencies/Tailspin.SpaceGame.Web.Models'
allowPackageConflicts: true
And the issue is resolved now...
Thank you guys...
~KC
Solution 7:[7]
For me it was because I set up my NuGet Push ADO task up incorrectly. I found out this is the way to do it. Just update the $VARIABLES
:
- task: NuGetCommand@2
name: pushNuGetPkg
displayName: "Push NuGet"
inputs:
command: 'push'
packagesToPush: '$(Build.Repository.Localpath)\Packages\*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: '$ARTIFACTS_FEED_NAME'
publishVstsFeed: '$AZURE_ORGANIZATION_NAME/$ARTIFACTS_FEED_NAME'
Solution 8:[8]
The other answers are good, and will likely solve the issue for most ppl. For me, my issue turned out to be something different, so I'll post it here in case it helps someone.
I was trying out the Pipeline by creating a Pull Request from a fork. Then, I was pushing commits to that fork, each of which was triggering a pipeline run, without merging the fork.
The issue is that the authentication for artifacts didn't work properly from the fork, leading to the same cryptic error as in the OP's question. This was solved when I finally merged the fork.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | William Trigos |
Solution 2 | |
Solution 3 | Community |
Solution 4 | Jevon Kendon |
Solution 5 | Sudarshan_SMD |
Solution 6 | aviboy2006 |
Solution 7 | kayleeFrye_onDeck |
Solution 8 | vlee |