dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.91k stars 389 forks source link

Unable to install package from private (Azure Artifacts) feed with #r #3627

Closed cthlo closed 3 months ago

cthlo commented 3 months ago

Describe the bug

Error: C:\.....\.packagemanagement\nuget\Projects\...\Project.fsproj: error NU1301: Unable to load the service index for source ..../index.json.

Hi,

I'm trying to use #r to install a nuget package from a private Azure Artifacts feed in my notebook. But the above error is shown. However, I am able to perform nuget install from a pwsh cell in the same notebook no problem. The creds are handled by VstsCredentialProvider. By any chance, it is not authenticated properly when using the magic command? How can I debug this?

Thank you!

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

Screenshots

image

jonsequitur commented 3 months ago

Can you provide the code you're running and a screen shot?

cthlo commented 3 months ago

Can you provide the code you're running and a screen shot?

Here's a screenshot of the cell and output: image

jonsequitur commented 3 months ago

Does the feed require authentication?

.NET Interactive doesn't provide any way to authenticate with a NuGet feed. If the feed requires authentication, the recommendation is to include a PAT in your nuget.config.

cthlo commented 3 months ago

Does the feed require authentication?

.NET Interactive doesn't provide any way to authenticate with a NuGet feed. If the feed requires authentication, the recommendation is to include a PAT in your nuget.config.

Yes, it does. Our setup is handled by VstsCredentialProvider.

I'm able to install via nuget install in a pwsh cell in the same notebook: image

Does #r interact with NuGet differently?

jonsequitur commented 3 months ago

#r performs a dotnet restore. It's not interactive, so if authentication is needed and no PAT is provided in nuget.config, it fails.

cthlo commented 3 months ago

#r performs a dotnet restore. It's not interactive, so if authentication is needed and no PAT is provided in nuget.config, it fails.

I see. Thanks, Jon.