Consuming Package From Private Azure Artifacts In Azure DevOps Server

0

I am using Azure DevOps On-Prem (Version Dev17.M153.3) and I have 2 projects. Let's say the first one is 'A' and the second one is 'B'

PS: I am using my own build agent.

A project doesn't have any dependency. B project depends on A project.

I made a build pipeline for A project then I publish the package from private Azure Artifacts. Now I need the consume this package in my B project's build pipeline.

My feed permissions like below;

enter image description here

My B project referenced A project from the NuGet manager. But when I tried to complete build I got error while restoring.

Firt try from vstsFeed :(

- task: DotNetCoreCLI@2
  inputs:
    command: 'restore'
    projects: '**/src/**/*.csproj'
    feedsToUse: 'select'
    vstsFeed: '/ea7b2012-c3d3-40e5-80da-487d4013a34f' 

Second try from Nuget.config file

- task: DotNetCoreCLI@2
  inputs:
    command: 'restore'
    projects: '**/src/**/*.csproj'
    feedsToUse: config
    nugetConfigPath: '$(Build.SourcesDirectory)/src/Naf.Core.Repository/NuGet.config'
    includeNuGetOrg: true

Both are not working an I got this error

Restoring packages for .NETCoreApp,Version=v3.1...
           GET https://api.nuget.org/v3-flatcontainer/naf.models/index.json
     1>C:\Azure-Nuevo-Build\_tool\dotnet\sdk\3.1.201\NuGet.targets(124,5): error : Unable to load the service index for source https://xxx.xxxx.com:1234/prj/_packaging/29371197-8dc0-72e7-b8e9-233be25307e3/nuget/v3/index.json. [C:\XXX-XXX-XXX\3\s\src\Naf.Core.Repository\Naf.Core.Repository.csproj]
C:\Azure-Nuevo-Build\_tool\dotnet\sdk\3.1.201\NuGet.targets(124,5): error :   No credentials are available in the security package [C:\XXX-XXX-XXX\3\s\src\Naf.Core.Repository\Naf.Core.Repository.csproj]
         NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://xxx.xxxx.com:1234/prj/_packaging/29371197-8dc0-72e7-b8e9-233be25307e3/nuget/v3/index.json.
          ---> System.ComponentModel.Win32Exception (0x8009030E): No credentials are available in the security package

I guess it says no access the feed from pipeline.

Any idea to solve this issue.

In Azure DevOps Cloud solution when you toggle 'Limit job authorization scope to current project' it works. but in Azure DevOps Server (on-prem) that choice is not available. According to this question

azure-pipelines
azure-artifacts
build-agent
azure-devops-self-hosted-agent
azure-devops-server
asked on Stack Overflow Apr 28, 2020 by arslanaybars

1 Answer

2

Try to use custom command to restore the package to see whether it helps you:

- task: DotNetCoreCLI@2
  displayName: 'dotnet custom'
  inputs:
    command: custom
    projects: '**/*.csproj'
    custom: restore
    arguments: '--force'
    vstsFeed: '/ea7b2012-c3d3-40e5-80da-487d4013a34f'
answered on Stack Overflow Apr 29, 2020 by Cece Dong - MSFT

User contributions licensed under CC BY-SA 3.0