Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 8 RC2 does not honor ignore-failed-sources flag when running dotnet tool install #36473

Open
aaronwjha opened this issue Oct 23, 2023 · 27 comments
Milestone

Comments

@aaronwjha
Copy link

When installing dotnet tools with a configured nuget source that fails to load, the --ignore-failed-sources flag is not honored.

Description

PS C:\Users\***\source\repos\jhld_reporting_templates> dotnet tool install JackHenry.Report.Fake --add-source "c:\Users\***\downloads" --global --ignore-failed-sources --verbosity diag 
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/jackhenry.report.fake/index.json
[NuGet Manager] [Info]   NotFound https://api.nuget.org/v3/registration5-gz-semver2/jackhenry.report.fake/index.json 61ms
[NuGet Manager] [Warning] The plugin credential provider could not acquire credentials. Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
[NuGet Manager] [Warning] The plugin credential provider could not acquire credentials. Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
[NuGet Manager] [Info]   GET https://***.com/artifactory/api/nuget/v3/nuget/FindPackagesById()?id='jackhenry.report.fake'&semVerLevel=2.0.0
[NuGet Manager] [Info]   Unauthorized https://***.com/artifactory/api/nuget/v3/nuget/FindPackagesById()?id='jackhenry.report.fake'&semVerLevel=2.0.0 107ms
Unhandled exception: NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://pkgs.dev.azure.com/*****/nuget/v3/index.json.
 ---> 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.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3(SourceRepository source, DateTime utcNow, ILogger log, CancellationToken token)
   --- End of inner exception stack trace ---
   at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3(SourceRepository source, DateTime utcNow, ILogger log, CancellationToken token)
   at NuGet.Protocol.ServiceIndexResourceV3Provider.TryCreate(SourceRepository source, CancellationToken token)
   at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T](CancellationToken token)
   at NuGet.Protocol.PackageMetadataResourceV3Provider.TryCreate(SourceRepository source, CancellationToken token)
   at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T](CancellationToken token)
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetPackageMetadataAsync(PackageSource source, String packageIdentifier, Boolean includePrerelease, 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.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)

Configuration

.NET 8 RC2
Windows 10 Ent, x64

Regression?

This works properly with .NET 7

@michaelgsharp
Copy link
Member

@dsplaisted

@michaelgsharp michaelgsharp transferred this issue from dotnet/core Oct 25, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Tools untriaged Request triage from a team member labels Oct 25, 2023
@dsplaisted
Copy link
Member

@JL03-Yue This is probably because the RestoreActionConfig isn't being created correctly based on the command line options. I think we recently looked at another similar bug with the NoCache option.

@frederikstonge
Copy link

Still an issue with 8.0.100 release.

@ricardoMTC
Copy link

I normally would use the --ignore-failed-sources but I'm also getting some errors upon using it. Also using 8.0.100

image

@ChristoWolf
Copy link

Hi!

Chiming in to say that I am also observing the same issue.

@PaulVrugt
Copy link

PaulVrugt commented Nov 16, 2023

same here, any workaround?

This issue is breaking our build pipeline, so we are unable to migrate to .net 8 SDK

@ChristoWolf
Copy link

@PaulVrugt: I think a work-around would be to create a basic Nuget.Config file only containing the nuget.org feed and to pass this then to the command.

@PaulVrugt
Copy link

@ChristoWolf yes thank you, I found a similar workaround

@ChristoWolf
Copy link

I also had time now to try out this work-around, works fine.
Still, it would be great if this issue would be resolved as soon as possible.

@marci4
Copy link

marci4 commented Nov 28, 2023

Any update on this issue?

Is there a way on how we can speed up the process here?

@hannahbellelee
Copy link

I tend to think this is an issue unrelated to .NET8 as a whole. I have been getting failures on dotnet tool install before I installed .NET8.. It first started showing up in Visual Studio Code in my powershell terminal, so I thought it was something specifically related to VSCode, but when I opened a terminal or a powershell window outside of VSCode Id get the same thing....And always with the telerik nuget package....And what I am installing has nothing to do with the telerik nuget package.
image

I have been using a small workaround for months, because I thought this would get fixed eventually. So what I have to do is open:

C:\Users\dev007\AppData\Roaming\NuGet\NuGet.Config

And comment out the telerik key( I have 9 other keys in there and none of them cause an error except the telerik one):

<!-- <add key="Telerik NuGet" value="https://nuget.telerik.com/v3/index.json" /> -->

Save the file, then rerun

[dev007]$ dotnet tool install -g SOME_PACKAGE_TO_INSTALL

The install worked perfectly:
image

but now the Nuget Source is not available in Visual Studio, so I have to open the file back up and uncomment it then save the file again...

@ChristoWolf
Copy link

ChristoWolf commented Nov 28, 2023

@hannahbellelee: I think your problem is a bit different from the reported one here, correct me if I'm wrong.

The issue here is specifically caused by the newest .NET SDK.

@ChristoWolf
Copy link

Hi @JL03-Yue!

Has there been any progress?
We have to use the work-around in quite a few places currently.

@marci4
Copy link

marci4 commented Jan 10, 2024

Just wanna confirm that this is still an issue with 8.0.101

@ricardomomm
Copy link

Still an issue :(

@frederikstonge
Copy link

frederikstonge commented Jan 11, 2024

Here's my workaround. Create a nuget-tools.config :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To
    inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

Then use this :

dotnet tool install --global <package-name> --configfile nuget-tools.config

@wexman
Copy link

wexman commented Jan 24, 2024

I'm kind of losing hope that this will be fixed, as it is still not working today.
If you're going at it, how about fixing --interactive as well?

@mcallaghan-geotab
Copy link

mcallaghan-geotab commented Jan 24, 2024

If you're going at it, how about fixing --interactive as well?

^ that isn't how software works :) - ADDING scope makes it less likely to get fixed :)

@baronfel
Copy link
Member

Just as a status update, this is one of a number of auth/feed related issues that we'll be looking at in the near term, but after the team finishes landing a few of their already-in-flight work items.

@jabaker88
Copy link

Also experiencing this issue

@hannahbellelee
Copy link

@hannahbellelee: I think your problem is a bit different from the reported one here, correct me if I'm wrong.

The issue here is specifically caused by the newest .NET SDK.

No this was not specific to a new version. The same thing was happening before the update... But once I noticed it wasnt fixed with the update, i posted it...There are workarounds, but there really shouldnt have to be...

@hannahbellelee
Copy link

I went in to my Control Panel , into credential manager for windows, and updated any credentials for any nuget packages...then from an admin powershell reinstalled nuget...and nuget cli and after that things seemed to work which is very odd, but in any case... I will let you know if i get a chance to test again later.

@byronbayer
Copy link

yep this is still happening on our pipelines when trying to install ReportGenerator tool in the pipeline.
Our workaround is to add the following to the nuget.config file

<disabledPackageSources>
        <add key="my-org-package-location" value="true" />
</disabledPackageSources>

@hannahbellesheart
Copy link

hannahbellesheart commented Mar 5, 2024

Everytime I ran into this, it always seemed to be related to the telerik feed AUTHENTICATION. I never get an error on the devexpress feed, which also requires authentication. or any other feed. So the only thing that has fixed this for me is the following...And when I say fixed, i mean I have not had a single error since running this. Of course replace the username and password with your own....

Open the Package Manager Console in VS2022.
At the PM> prompt, use the following command.
PM>NuGet Sources Update -Name 'Telerik NuGet' -Source 'https://nuget.telerik.com/v3/index.json' -UserName '[email protected]' -Password 'YUR_TELERIK_PW'

@epenet
Copy link

epenet commented Mar 26, 2024

For those who have this issue on CI / Azure Pipeline, and are looking for a workaround, I have found that it is possible to add a preliminary job in the configuration to force NuGet to authenticate against the Azure private feeds :

jobs:
  - job: Build
    steps:
      (...)

      # NuGet authenticate
      - task: NuGetAuthenticate@1

      # Install report generator
      - script: 'dotnet tool install -g dotnet-reportgenerator-globaltool --verbosity detailed --ignore-failed-sources'

With this workaround in place, the private feeds no longer fail, and --ignore-failed-sources becomes redundant.

Note: this was the previous error:

Generating script.
Script contents: shell
dotnet tool install -g dotnet-reportgenerator-globaltool --verbosity detailed --ignore-failed-sources
========================== Starting Command Output ===========================
"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\2cdd5da9-bb28-47ff-98de-70feab461169.cmd""
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-reportgenerator-globaltool/index.json
[NuGet Manager] [Info]   GET https://pkgs.dev.azure.com/xxxxxxxxx/nuget/v3/registrations2-semver2/dotnet-reportgenerator-globaltool/index.json
[NuGet Manager] [Info]   Unauthorized https://pkgs.dev.azure.com/xxxxxxxxx/nuget/v3/registrations2-semver2/dotnet-reportgenerator-globaltool/index.json 53ms
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-reportgenerator-globaltool/index.json 134ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-reportgenerator-globaltool/page/4.0.0-alpha10/4.2.16.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-reportgenerator-globaltool/page/4.0.0-alpha10/4.2.16.json 104ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-reportgenerator-globaltool/page/4.2.17/5.1.1.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-reportgenerator-globaltool/page/4.2.17/5.1.1.json 104ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-reportgenerator-globaltool/page/5.1.2/5.2.4.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-reportgenerator-globaltool/page/5.1.2/5.2.4.json 103ms
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__DisplayClass19_0.<Execute>b__1()
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)

@reijerh
Copy link

reijerh commented Apr 3, 2024

Still bugged in SDK 8.0.203
afbeelding

@ChristoWolf
Copy link

Hi!

Are there any new plans on when a fix for this can be released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests