Reputation: 45125
In a new netcore20 project I am using dotnet test
for the first time, this restores and builds and its the restore part that's failing.
I'm using Visual Studio Code for the first time.
"C:\Data\Git\PDQShockerRestAPI\src\PDQShockerRestAPIWebApp.UnitTests\PDQShockerRestAPIWebApp.UnitTests.csproj" (Restore target) (1) ->
(Restore target) ->
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Unable to load the service index for source https://contoso-pdq.pkgs.visualstudio.com/_packaging/ContosoPDQNetFramework/nuget/v3/index.json.\r [C:\Data\Git\PDQShockerRestAPI\src\PDQShockerRestAPIWebApp.UnitTests\PDQShockerRestAPIWebApp.UnitTests.csproj]
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\Data\Git\PDQShockerRestAPI\src\PDQShockerRestAPIWebApp.UnitTests\PDQShockerRestAPIWebApp.UnitTests.csproj]
I've copied the .nuget
folder from another solution into /src/.nuget
in this solution but it doesn't work.
My hunch is that VS2017 was authenticated automatically perhaps via the IDE and that VSCode isn't?
Upvotes: 5
Views: 3286
Reputation: 45125
The feed is on VSTS. I needed to download and run the NuGet authentication helper tool for VSTS.
https://www.visualstudio.com/en-us/docs/package/nuget/auth-old
After running that tool against my /src/.nuget/NuGet.config
I was presented with a mini login browser window and signed-in to VSTS. After a few seconds it completed and when I tried dotnet test
again it was fine.
PS C:\Data\Git\PDQShockerRestAPI\src\.nuget> ./VSS.NuGet.AuthHelper.exe -Config .\NuGet.Config
Getting new credentials for source:VSO Libraries Feed, scope:vso.packaging_write vso.drop_write
Interestingly, no changes were made to the NuGet.config
file I specified..!
Upvotes: 3