1

we are updating the nuget packages in dotnet application with dotnet add package "package name" from a private feed in Azure Devops. Recently we updated to .net 5.0.1( I am not sure if its related to the issue.) But now while running the above command gives error in local machine as well as in azure piplelines. I have tried the --interactive option and refreshed the PAT for packages etc as well.

command dotnet add "csprojFile" package "mypackageName"

Determining projects to restore...
      Writing C:\Users\SirajUrRahman\AppData\Local\Temp\tmpD8BD.tmp
    info : Adding PackageReference for package 'my package' into project '.\my csproj'.
    info :   GET https://api.nuget.org/v3/registration5-gz-semver2/mypackageName/index.json
    info :   NotFound https://api.nuget.org/v3/registration5-gz-semver2/mypackageName/index.json 889ms
    error: Unable to load the service index for source https://pkgs.dev.azure.com/myorganization/_packaging/Feed/nuget/v3/index.json.
    error:   Response status code does not indicate success: 401 (Unauthorized).
    
    
Usage: NuGet.CommandLine.XPlat.dll package add [options]

Options:
  -h|--help               Show help information
  --force-english-output  Forces the application to run using an invariant, English-based culture.
  --package               Id of the package to be added.
  --version               Version of the package to be added.
  -d|--dg-file            Path to the dependency graph file to be used to restore preview and compatibility check.
  -p|--project            Path to the project file.
  -f|--framework          Frameworks for which the package reference should be added.
  -n|--no-restore         Do not perform restore preview and compatibility check. The added package reference will be unconditional.
  -s|--source             Specifies NuGet package sources to use during the restore.
  --package-directory     Directory to restore packages in.
  --interactive           Allow the command to block and require manual action for operations like authentication.
  --prerelease            Allows prerelease packages to be installed.

Thanks for any help. Feel free to ask anything if needed.

Siraj ur Rahman
  • 213
  • 3
  • 13

1 Answers1

2

This issue was related to .net 5 and there is already a bug created for that on github here is the link for that. https://github.com/NuGet/Home/issues/10305.

Siraj ur Rahman
  • 213
  • 3
  • 13
  • 1
    Hi, Thanks for the sharing, you could [Accept it as an Answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235) , it could help other community members who get the same issues and we could archive this thread, thanks. – Vito Liu Dec 30 '20 at 09:42