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

arslanaybars
  • 1,813
  • 2
  • 24
  • 29

1 Answers1

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'
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • Unfortunately, this doesn't work. Azure DevOps server 2019 simply cannot restore from internal nuget feeds: `warning NU1801: Unable to load the service index for source`. I also think, Microsoft is aware: https://github.com/microsoft/azure-pipelines-tasks/issues/12471#issuecomment-594810802 – reckface Jul 25 '20 at 11:14
  • Before this can work, you need to manually install the nuget authenticate task from: https://github.com/microsoft/azure-pipelines-tasks/issues/12471#issuecomment-594810802 note, your version of node.js as well as npm need to be up-to-date. – reckface Jul 25 '20 at 15:23