0
votes

I'm running TeamCity 10.0.5, and as part of our Continuous Integration builds I want to package a few Dlls together and publish them to a NuGet feed hosted by Visual Studio Online...

The Publish step is current failing to authenticate with the Nuget feed, as evidenced by this extract from the build log...

Step 4/7: Publish BL, DAL and Entities nuget (NuGet Publish) (4s)
[13:31:30][Step 4/7] push: Publish package OutputPackages\KeyedIn.Project.BLandDAL.1.0.0.nupkg (4s)
[13:31:30][push] NuGet command: C:\TeamCity\buildAgent\plugins\nuget-agent\bin\JetBrains.TeamCity.NuGetRunner.exe C:\TeamCity\buildAgent\tools\NuGet.CommandLine.4.0.0\tools\NuGet.exe push C:\TeamCity\buildAgent\work\dc03049e2a33b930\OutputPackages\KeyedIn.Project.BLandDAL.1.0.0.nupkg %%teamcity_nuget_api_key_1491222690775%% -Source https://keyedincleckheaton.pkgs.visualstudio.com/_packaging/NuGet_Feed/nuget/v3/index.json
[13:31:30][push] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script1071157934831391257.cmd
[13:31:30][push] in directory: C:\TeamCity\buildAgent\work\dc03049e2a33b930\OutputPackages
[13:31:31][push] JetBrains TeamCity NuGet Runner 8.0.42677.9
[13:31:31][push] Registered additional extensions from paths: C:\TeamCity\buildAgent\plugins\nuget-agent\bin\plugins-2.0
[13:31:31][push] Starting NuGet.exe 4.0.0.2283 from C:\TeamCity\buildAgent\tools\NuGet.CommandLine.4.0.0\tools\NuGet.exe
[13:31:32][push] WARNING: Failed to load C:\TeamCity\buildAgent\plugins\nuget-agent\bin\plugins-2.0\JetBrains.TeamCity.NuGet.ExtendedCommands.2.0.dll
[13:31:32][push] Could not load type 'NuGet.Commands.Command' from assembly 'NuGet, Version=4.0.0.2283, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
[13:31:32][push] 
[13:31:34][push] Please provide credentials for: https://keyedincleckheaton.pkgs.visualstudio.com/_packaging/NuGet_Feed/nuget/v3/index.json
[13:31:34][push] Unable to load the service index for source https://keyedincleckheaton.pkgs.visualstudio.com/_packaging/NuGet_Feed/nuget/v3/index.json.
[13:31:34][push]   Response status code does not indicate success: 401 (Unauthorized).
[13:31:34][push] UserName: 
[13:31:34][push] Process exited with code 1
[13:31:34][Step 4/7] Step Publish BL, DAL and Entities nuget (NuGet Publish) failed

I am trying to determine what I have done wrong - the log indicates that there is no username provided, but I can't see anywhere on the screen to enter one:

enter image description here

Reading online it seems like authentication problems are common - can anyone offer any guidance?

Thanks

2

2 Answers

3
votes

You need to add corresponding VSTS feed with username and password to Nuget source file.

  1. Create a Personal Access Token
  2. Add feed to source (nuget.exe sources add -name {your feed name} -source {your feed URL} -username {anything} -password {your PAT})
  3. Run build in TeamCity

After that, you can check the related feed source in %APPDATA%\NuGet\NuGet.config file.

Note: the API key could be any non-empty string you want, such as key, vsts.

0
votes

Authenticating with an the VSTS NuGet feed can also be done by adding a NuGet Feed Credentials build feature, and just adding the package source in the NuGet step. Also use the PAT for this build feature.