Using the .NET CLI to restore packages from a private NuGet feed
For the past years, I've been working in Visual Studio (the 2022 preview version is available), but recently I've given Visual Studio Code a shot. Transitioning between the two IDE's also means that you use the .NET CLI more extensively. Sadly, this was the cause of one annoying problem for me.
A couple of times a day, when I was trying to build a project, I bumped against the following error saying that I'm not authorized to access our private feed.
This led to frustrations and was counter-productive. As a work-around, I opened the project in Visual Studio to be authorized.
Some GitHub issues mentioned running the restore command with the interactive flag, but in my case, this ended up in the same error.
After browsing through more GitHub issues, I found a comment that suggested installing the Microsoft NuGet CredentialProvider.
To my satisfaction, the error was finally gone.
I appreciate it if you would support me if have you enjoyed this post and found it useful, thank you in advance.