Search code examples
azure-devopsnuget

"dotnet restore --interactive" doesn't work with Azure Artifacts


I have a newly installed Windows 10 machine with the .NET Core SDK 3.0.100. I have a project with it's nuget.config file containing (among other reference) a reference to an Azure Artifacts nuget feed, and i'd like to access credentials to this feed interactively. It's worth to point out that i'd like to use command line to achieve this. My IDE of choice is Jetbrains Rider and not Visual Studio (for this particular question i'm not sure that matters though).

I have downloaded the Azure Artifacts Credential Provider by running a powershell command (Invoke-WebRequest...) and installed it - what seems - successfully. Now I have a nuget plugin on my computer that's supposed to help me retrieve credentials for azure artifact feeds.

What i do expect to work is that running dotnet restore --interactive should prompt me to enter credentials, but it doesnt. It doesnt prompt at all, and just complains that it cannot find the packages.

I've tried this other times too, both on MacOS and Windows with my colleagues, and it always seem to be some problems related to this. Any ideas what i'm doing wrong?

Thanks for your help!


Solution

  • I'll answer my own question as it might help someone else.

    When I tried dotnet restore --configfile .\.nuget\NuGet.Config --interactive it did prompt me. I could login in and everything worked!

    I'm not sure why, but it seems that just running dotnet restore --interactive doesn't pick the correct nuget sources - or at least not the ones I have defined in .\.nuget\NuGet.Config in my local project. And therefore the credential provider (obviously) won't prompt me for anything. I haven't found any details on whether this is the expected behaviour or a bug.