Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot run Nuget Package Restore from private Team City Nuget Server

Tags:

nuget

teamcity

Current discussion thread: http://devnet.jetbrains.com/message/5519081#5519081

Bug Report: http://youtrack.jetbrains.com/issue/TW-37148

Error: Cannot prompt for input in non-interactive mode.

One thing to note is that the credentials prompt is triggering on each package download instead of at the beginning. I think this may be a bug in the way Team City is calling NuGet, but I'm not sure.

I have the "NuGet Feed Credentials" build feature configured, basic auth configured, and I've run the feed in Firefox and got the list of packages to show up on the agent machine (with credentials required).

My build log: https://gist.github.com/tonyeung/517597ca2312dad85f62

like image 561
ton.yeung Avatar asked Jul 02 '14 15:07

ton.yeung


4 Answers

The following is a workaround which may help you, although I was of the impression the NuGet Feed Credentials build feature was meant to fix the problem. I was having a similar issue with the internal TeamCity NuGet feed without guest access (called Local in this example).

Initial build step (command line - custom script)

del /F %env.APPDATA%\NuGet\NuGet.Config
%teamcity.agent.tools.dir%\NuGet.CommandLine.DEFAULT.nupkg\tools\nuget.exe sources add -name Local -source %env.NuGetFeed%
%teamcity.agent.tools.dir%\NuGet.CommandLine.DEFAULT.nupkg\tools\nuget.exe sources update -Name Local -User %env.BuildServiceUser% -pass %env.BuildServicePassword%

As I say, it's a workaround, but not too much to maintain if using templates. Hopefully it gets you up and running.

like image 108
SteveChapman Avatar answered Sep 20 '22 03:09

SteveChapman


I know this is an old question, but I recently came across this issue in TeamCity 9.1.7.

In my case, the issue was that I had a trailing slash on the Server URL, found in Administration > Global Settings. Removing that slash made the authentication work correctly.

like image 32
Steve Czetty Avatar answered Sep 20 '22 03:09

Steve Czetty


For the TeamCity 8.1.2 (build 29993), I solved this issue by installing the Nuget v. 2.8.0 at the TeamCity Administration panel (I had v.2.8.2). Then I've added "Nuget Install" build step and set up the NuGet Feed Credentials build feature. Probably, if you'll update the TeamCity it would also fix this issue.

like image 39
Alexander Skogorev Avatar answered Sep 18 '22 03:09

Alexander Skogorev


To solve

http://localhost:80/httpAuth/app/nuget/v1/FeedService.svc: The V2 feed at 'http://localhost/httpAuth/app/nuget/v1/FeedService.svc/Packages(Id='***',Version='1.0.0')' returned an unexpected status code '401 Unauthorized'.

issue I have done:

  1. create local administrator account

    net user tcbagent password123 /add
    net localgroup administrators tcbagent /add
    
  2. attach "Logon as service" permissions (using Carbon PS helpers)

    Grant-CAPrivilege -Identity tcbagent "SeServiceLogonRight"
    
  3. create account within TeamCity
  4. run cmd using destination environment

    runas /user:tcbagent cmd
    
  5. add nuget source with credentials

    nuget sources add -name local -source http://localhost/httpAuth/app/nuget/v1/FeedService.svc -UserName tcbagent -Password password123 
    

    localhost of whatever you need

check your teamcity-build.log file to get something like this:

Starting NuGet.exe 3.5.0.1284 from C:\TeamCity\buildAgent\tools\NuGet.CommandLine.DEFAULT\tools\NuGet.exe
...
Restoring NuGet package xxxx.
...
Using credentials from config. UserName: tcbagent

TeamCity v9.1.7, NuGet v3.5.0-beta

I've spend 2 days to resolve it because I'm quite new with TeamCity and CI. Hope it was helpful.

like image 24
Vladislav Sorokin Avatar answered Sep 20 '22 03:09

Vladislav Sorokin