NU1100: Unable to resolve Azure DevOps nuget package

We have an Azure DevOps nuget package that another service which is a net api uses without a problem. However, when this package is added to the worker service, pr pipeline fails at the “Restore Dependencies” step with NU1100 error.

Pipeline file

trigger:
  branches:
    exclude:
      - '*'
  paths:
    include:
      - '*'

pr:
  branches:
    include:
      - '*'

pool:
  vmImage: ubuntu-latest

variables:
  - name: vmImageName
    value: 'ubuntu-latest'

stages:
  - stage: PR
    displayName: Build and test
    jobs:
      - job: Build
        displayName: Build
        pool:
          vmImage: $(vmImageName)
        steps:
          - task: UseDotNet@2
            displayName: 'Install .NET Core SDK'
            inputs:
              packageType: 'sdk'
              version: '8.x'
              performMultiLevelLookup: true

          - task: NuGetToolInstaller@1
            displayName: 'Install NuGet'
            inputs:
              versionSpec: '6.8.0'

          - task: NuGetAuthenticate@1
            displayName: 'NuGet Authenticate'

          - task: DotNetCoreCLI@2
            displayName: 'Restore Dependencies'
            inputs:
              command: 'restore'
              projects: '**/*.csproj'
              feedsToUse: 'config'
              nugetConfigPath: 'nuget.config'
              includeNuGetOrg: true
              noCache: true

          - task: DotNetCoreCLI@2
            displayName: 'Build'
            inputs:
              command: 'build'
              projects: '**/*.csproj'
              arguments: '--configuration $(buildConfiguration) --no-restore'

      - job: Test
        displayName: Test
        pool:
          vmImage: $(vmImageName)
          steps:
            - task: NuGetAuthenticate@1
              displayName: 'NuGet Authenticate'

            - task: DotNetCoreCLI@2
              displayName: "Run Unit Tests"
              inputs:
                command: test
                projects: '**/*.UnitTests.csproj'
                arguments: '--configuration $(buildConfiguration)'

nuget.config:

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>

  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="Custom"
         value="https://pkgs.dev.azure.com/acme/guid/_packaging/Custom/nuget/v3/index.json" />
  </packageSources>

  <packageSourceCredentials>
    <NxPro>
      <add key="Username" value="build" />
      <add key="ClearTextPassword" value="%PAT%" />
    </NxPro>
  </packageSourceCredentials>
  <packageSourceMapping>
    <packageSource key="Custom">
      <package pattern="Custom.*" />
    </packageSource>
    <packageSource key="nuget.org">
      <package pattern="*" />
    </packageSource>
  </packageSourceMapping>
</configuration>

error:

Build FAILED.

       "/home/vsts/work/1/s/src/Infrastructure/ServiceWorker.Infrastructure.csproj" (Restore target) (1) ->
       (Restore target) -> 
         /home/vsts/work/1/s/src/Infrastructure/ServiceWorker.Infrastructure.csproj : error NU1100: Unable to resolve 'Custom.Contracts (>= 1.0.31)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: feed-Custom, nuget.org.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:07.64
##[error]Error: The process '/opt/hostedtoolcache/dotnet/dotnet' failed with exit code 1
##[error]Packages failed to restore
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
Finishing: Restore Dependencies

The other service that uses the same package has a different pipline file where instead of DotNetCoreCli@2 restore NuGetCommand@2 is used. This approach for a reason that I couldn’t understand didn’t work with this service and kept ending up with MsBuild version error.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật