dotnet / dotnet/fsharp

Disabling authenticated NuGet feed not enough to get around 11392

Open
#12,874 1 comment 2 reactions 0 assignees View on GitHub
Area-FSI Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

#11392 discusses an issue where NuGet cannot restore packages for authenticated feeds in the context of running an FSI script, and the going advice is to disable those feeds (assuming you don't actually need a NuGet package from the authenticated feeds). This has worked for me in the past and I even have note of it in my FSX file. However, today I had to go a step further because even disabling the authenticated feed wasn't enough. I had to completely remove it via a custom `nuget.config`.

**Repro steps**

Provide the steps required to reproduce the problem:

1. Add an authenticated NuGet feed into your NuGet sources (in VS options, for example)

![image](https://user-images.githubusercontent.com/1901832/159830575-e61fc3ae-97ab-4367-ad82-b143d3193878.png)

2. Add a `Test.fsx` file that consumes a NuGet, such as `FSharp.Data`:

```fsharp
#r "nuget: FSharp.Data"
```

3. Attempt to run the script via `dotnet fsi Test.fsx`. Note the error "The plugin credential provider could not acquire credentials". You can see the same error if you open `Test.fsx` inside VS itself.
4. Disable the NuGet source in VS (and restart VS for good measure)
5. Attempt to run the script again (or open it in VS) and you'll see the same error. You can confirm the source is disabled via `dotnet nuget list source`:

![image](https://user-images.githubusercontent.com/1901832/159831114-a1fa5580-2769-4e09-8031-6688aefc4029.png)

7. Add a `nuget.config` to the same directory as the script:

```xml




```

8. Run the script again and observe that it now works

**Expected behavior**

Ideally, #11392 would be fixed and it would be possible to run with `--interactive` to actually authenticate the NuGet source. Failing that, at least disabling the source should work around it (but still it is very confusing to diagnose if you haven't hit this several times)

**Actual behavior**

```
error FS3217: C:\Program Files\dotnet\sdk\6.0.300-preview.22154.4\NuGet.targets(130,5): 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` [C:\Users\Kent\AppData\Local\Temp\nuget\65568--645b1f10-1df6-4c13-a601-000b372c3b8f\Project.fsproj]
```

**Known workarounds**

Adding the `nuget.config` discussed above.

**Related information**

Provide any related information (optional):

* Windows 10
* .NET core 6.0.300-preview.22154.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.