Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Restoring private Nuget package hosted in Azure DevOps with Github Actions fails

$
0
0

I have a .NET project that uses a private Nuget package that is hosted in Azure DevOps. I have a Github Actions workflow that registers the private feed with a personal access token, and restores the packages in the solution.This action fails with error NU1301: Unable to load the service index for sourceI have ensured that the feed is enabled, and that the personal access token has read rights on the Azure Artifact.

name: testson:  workflow_dispatch:  workflow_call:    inputs:      projectName:        description: "Project name"        required: true        type: string    secrets:      PAT:        required: true      USER:        required: trueenv:  DOTNET_VERSION: "7.0.x"jobs:  unit-test:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - name: Setup dotnet        uses: actions/setup-dotnet@v3        with:          dotnet-version: ${{ env.DOTNET_VERSION }}      - name: Run tests        working-directory: ./Solution        run: |          dotnet nuget update source private-source-name --source ${{ vars.PACKAGE_URL }} --username ${{ secrets.USER }} --password ${{ secrets.PAT }} --store-password-in-clear-text          dotnet restore          dotnet test Solution.Test.${{ inputs.projectName }}

I have tried to register the feed and restore as per dotnet documentation, both from solution-level NuGet.Config, as well as top level NuGet.Config, and ensured the config is correctly set up:

<?xml version="1.0" encoding="utf-8"?><configuration><packageSources><add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /><add key="private-source-name" value="private-source" /></packageSources><packageSourceCredentials><private-source-name><add key="Username" value="<username>" /><add key="ClearTextPassword" value="<clear-text-PAT>" /></private-source-name></packageSourceCredentials></configuration>

follwed by dotnet restore in the Solution. I have also done it with nuget restore from the specified config files.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>