Open Think3wang opened 4 years ago
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'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\
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
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 -
<?xml version="1.0" encoding="utf-8"?>
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?
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.
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
Same issue here. --ignore-failed-sources
used to work but somewhere along the way it now fails. I have custom sources and have had to use that flag for years but after updating to NET 8 it doesn't seem to work anymore. Seems like a regression bug.
Same issue. I get this:
PS C:\Users\whisky\Desktop\test> dotnet --version
8.0.303
PS C:\Users\whisky\Desktop\test> dotnet tool update --global dotnet-ef --ignore-failed-sources
Unhandled exception: System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at NuGet.Protocol.HttpSource.<>c__DisplayClass15_0`1.<<GetAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T](String filePath, Func`2 action, CancellationToken token)
at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T](String filePath, Func`2 action, CancellationToken token)
at NuGet.Protocol.HttpSource.GetAsync[T](HttpSourceCachedRequest request, Func`2 processAsync, ILogger log, CancellationToken token)
at NuGet.Protocol.PackageMetadataResourceV3.LoadRegistrationIndexAsync(HttpSource httpSource, Uri registrationUri, String packageId, SourceCacheContext cacheContext, Func`2 processAsync, ILogger log, CancellationToken token)
at NuGet.Protocol.PackageMetadataResourceV3.GetMetadataAsync(String packageId, Boolean includePrerelease, Boolean includeUnlisted, VersionRange range, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token)
at NuGet.Protocol.PackageMetadataResourceV3.GetMetadataAsync(String packageId, Boolean includePrerelease, Boolean includeUnlisted, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token)
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetPackageMetadataAsync(PackageSource source, String packageIdentifier, Boolean includePrerelease, Boolean includeUnlisted, CancellationToken cancellationToken)
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetMatchingVersionInternalAsync(String packageIdentifier, IEnumerable`1 packageSources, VersionRange versionRange, CancellationToken cancellationToken)
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetBestPackageVersionAsync(PackageId packageId, VersionRange versionRange, PackageSourceLocation packageSourceLocation)
at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.<InstallPackage>b__0()
at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass20_0.<Execute>b__1()
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
at Microsoft.DotNet.Tools.Tool.Update.ToolUpdateGlobalOrToolPathCommand.Execute()
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
The workaround that worked for me:
Create a nuget config that only references the nuget.org feed:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="public" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
call dotnet tool update --global dotnet-ef --configfile .\nuget.config
referencing the clean nuget.config
If the problem is that the feed is not public, you can install the CredentialProvider to make dotnet commands prompt for login: https://github.com/microsoft/artifacts-credprovider
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 :