Azure DevOps publish Nuget to hosted feed

10,331

Solution 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 toFeed Settings/Permission through Gear Button on right side of artifacts page enter image description here

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

enter image description here

This is a useful tutorial for replicate my test.

Cheers!!

Solution 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

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 4

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.

Share:
10,331
sacha barber
Author by

sacha barber

Updated on June 09, 2022

Comments

  • sacha barber
    sacha barber almost 2 years

    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

    enter image description here

    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")

    enter image description here

    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

    enter image description 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

    enter image description here

    I have then created this feed in one of the projects of the organisation

    enter image description here

    With these settings enter image description here

    enter image description here

    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
    
  • sacha barber
    sacha barber over 4 years
    Yeah that also failed, this is from the output in Devops _packaging/nugetprojectstestfeed/nuget/v3/index.json but my actual feed name is NugetProjects/_packaging/nugetprojectstestfeed/nuget/v3/inde‌​x.json see how it has the "NuGetProjects" project name at the start. How do I set that as the project to use?
  • sacha barber
    sacha barber over 4 years
    Its like its just looking for feed at wrong location, its not looking in current DevOps project
  • Sudarshan_SMD
    Sudarshan_SMD over 4 years
    From the URL, I believe 'NuGetProject' is the name of the Organization that you have created.
  • Sudarshan_SMD
    Sudarshan_SMD over 4 years
    Have you created the Artifact- Feed in a different Organization than your Pipeline?
  • sacha barber
    sacha barber over 4 years
    No its all in the same one.
  • mike00
    mike00 over 4 years
    @sacha I'm getting exactly the same issue. Seems like they have a bug. The script try to push under wrong url which is slightly different than this in NuGet.config file.
  • sacha barber
    sacha barber over 4 years
    That's it. Same issue. Have no clue how to fix this
  • mike00
    mike00 over 4 years
    @sacha no, and I think it is microsoft's bug. Waiting for their response.
  • sacha barber
    sacha barber over 4 years
    Do you have a full example for this, as this still seems to fail for me
  • sacha barber
    sacha barber over 4 years
    So this did the trick. Yay. I can also see now that I can see the feeds being marked as project or organizational scope (MSFT patched something). So for the organizational one (my original feed in question) your fix worked. For project scope feed I needed to use 'nugetprojects\xxxfeed' in the YAML
  • sacha barber
    sacha barber over 4 years
    Ok so it looks good now. I can see new menu system in feeds, so it shows "project" or "organizational" feed now. Cant see how you would create a new "organizational" feed. Perhaps you can no longer do that using the UI itself, but REST API supports it
  • Dan
    Dan over 4 years
    This was very helpful
  • RSharma
    RSharma over 4 years
    Thanks William. You saved me :)
  • William Trigos
    William Trigos over 4 years
    nice to help you @Rharma
  • Navin prasad
    Navin prasad over 4 years
    Hey @WilliamTrigos, For me, the option 'Allow project-scoped build' is not showing.
  • William Trigos
    William Trigos over 4 years
    Tell me more about of access rights or permissions for pipelines in your project settings @Narvin?
  • Henrique Mauri
    Henrique Mauri about 4 years
    Very nice! Thanks
  • Kishor Tiwari
    Kishor Tiwari almost 3 years
    Thanks @WilliamTrigos. I was missing the project name before the feed name.
  • Techiemanu
    Techiemanu over 2 years
    @william. Thanks worked like a charm for me