sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Can not install dotnet-ef through CLI (Unauthorized)

Open think3wang opened this issue 5 years ago • 8 comments

I am trying to install dotnet-ef package through dotnet cli, how ever it gave me 401 (Unauthorized) error.

The command I run is dotnet tool install --global dotnet-ef what I don't understand is, the dotnet-ef is a public package that anyone can install, what is this "authorized" about?

The detailed result I got is :

C:\Program Files\dotnet\sdk\3.1.300\NuGet.targets(128,5): error : Unable to load the service index for source https://microsoft.pkgs.visualstudio.com/_packaging/Universal.Store/nuget/v3/index.json. [C:\Users\<myUserName>\AppData\Local\Temp\wojjcmbm.aon\restore.csproj]
C:\Program Files\dotnet\sdk\3.1.300\NuGet.targets(128,5): error :   Response status code does not indicate success: 401 (Unauthorized). [C:\Users\<myUserName>\AppData\Local\Temp\wojjcmbm.aon\restore.csproj]

think3wang avatar May 31 '20 21:05 think3wang

The authentication relates to the package feed it's trying to access. Check your global nuget.config file for that package source and potentially remove it. You can run dotnet nuget list source to see which sources you are using by default.

You can also try to run with --ignore-failed-sources.

joeloff avatar Aug 19 '20 21:08 joeloff

I'm getting the same issue. I'm not using any custom nuget.config files. These are my listed packages. I'm getting this error with .NET 5.0.100.

dotnet nuget list source
Registered Sources:
  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json
  2.  Microsoft Visual Studio Offline Packages [Enabled]
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

RehanSaeed avatar Nov 14 '20 12:11 RehanSaeed

If you have many sources for packages you will need to include " --ignore-failed-sources", that worked for me. dotnet tool install --global dotnet-ef --version 5.0.13 --ignore-failed-sources

gifthove avatar Jan 05 '22 10:01 gifthove

The authentication relates to the package feed it's trying to access. Check your global nuget.config file for that package source and potentially remove it. You can run dotnet nuget list source to see which sources you are using by default.

You can also try to run with --ignore-failed-sources.

I had to add nuget.config file with the following content -

prags9 avatar Aug 09 '22 12:08 prags9

The authentication relates to the package feed it's trying to access. Check your global nuget.config file for that package source and potentially remove it. You can run dotnet nuget list source to see which sources you are using by default. You can also try to run with --ignore-failed-sources.

I had to add nuget.config file with the following content -

@prags9 What content? A dash?

umerkle avatar Oct 21 '23 10:10 umerkle

I had some additional custom sources. Just using --ignore-failed-sources wasn't enough. I went into Visual Studio -> Tools -> Options -> NuGet Package Manager -> Package Sources and unchecked the extra package sources so only nuget.org and Microsoft Visual Studio Offline Packages was left checked. After doing that I was able to install the tool using dotnet tool install dotnet-ef --global --ignore-failed-sources, and then I re-enabled my custom package sources.

deadlydog avatar Jan 30 '24 03:01 deadlydog

I confirm: --ignore-failed-sources, isn't working, still getting 401 (Unauthorized). I temporarely removed the additional sources from the global nuget config file, then I was able to succesfully run dotnet tool install --global dotnet-ef

markopavic avatar Mar 27 '24 17:03 markopavic