【问题标题】:How to set up TeamCity to use own HTTP authenticated NuGet service?如何设置 TeamCity 以使用自己的 HTTP 身份验证 NuGet 服务?
【发布时间】:2016-06-01 11:21:15
【问题描述】:

问题是 TeamCity 无法授权进入在同一 TeamCity 实例上运行的 NuGet 服务。

您可以在下面找到构建配置现在的样子:

我还为 NuGet 凭据添加了构建功能:

使用此配置,我在日志中收到以下错误:

Restoring NuGet package Nuget.Package.Name.0.1.0.41.
Please provide credentials for: http://teamcity-nuget-server.cloudapp.azure.com/httpAuth/app/nuget/v1/FeedService.svc
UserName:   GET http://www.nuget.org/Packages(Id='Nuget.Package.Name';,Version='0.1.0.41')
NotFound http://www.nuget.org/Packages(Id='Nuget.Package.Name';,Version='0.1.0.41') 194ms
GET http://www.nuget.org/FindPackagesById()?id='Nuget.Package.Name';
NotFound http://www.nuget.org/FindPackagesById()?id='Nuget.Package.Name'; 105ms
WARNING: Unable to find version '0.1.0.41' of package 'Nuget.Package.Name'.
C:\Windows\system32\config\systemprofile\AppData\Local\NuGet\Cache: Package 'Nuget.Package.Name.0.1.0.41' is not found on source 'C:\Windows\system32\config\systemprofile\AppData\Local\NuGet\Cache'.
C:\Windows\system32\config\systemprofile\.nuget\packages\: Package 'Nuget.Package.Name.0.1.0.41' is not found on source 'C:\Windows\system32\config\systemprofile\.nuget\packages\'.
http://teamcity-nuget-server.cloudapp.azure.com/httpAuth/app/nuget/v1/FeedService.svc: Unable to load the service index for source http://teamcity-nuget-server.cloudapp.azure.com/httpAuth/app/nuget/v1/FeedService.svc.
Cannot prompt for input in non-interactive mode.
http://nuget.org: The V2 feed at 'http://www.nuget.org/FindPackagesById()?id='Nuget.Package.Name'' returned an unexpected status code '404 Not Found'.

Errors in packages.config projects
Unable to find version '0.1.0.41' of package 'Nuget.Package.Name'.
C:\Windows\system32\config\systemprofile\AppData\Local\NuGet\Cache: Package 'Nuget.Package.Name.0.1.0.41' is not found on source 'C:\Windows\system32\config\systemprofile\AppData\Local\NuGet\Cache'.
C:\Windows\system32\config\systemprofile\.nuget\packages\: Package 'Nuget.Package.Name.0.1.0.41' is not found on source 'C:\Windows\system32\config\systemprofile\.nuget\packages\'.
http://teamcity-nuget-server.cloudapp.azure.com/httpAuth/app/nuget/v1/FeedService.svc: Unable to load the service index for source http://teamcity-nuget-server.cloudapp.azure.com/httpAuth/app/nuget/v1/FeedService.svc.
Cannot prompt for input in non-interactive mode.
http://nuget.org: The V2 feed at 'http://www.nuget.org/FindPackagesById()?id='Nuget.Package.Name'' returned an unexpected status code '404 Not Found'.

NuGet Config files used:
C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config

Feeds used:
C:\Windows\system32\config\systemprofile\AppData\Local\NuGet\Cache
C:\Windows\system32\config\systemprofile\.nuget\packages\
http://teamcity-nuget-server.cloudapp.azure.com/httpAuth/app/nuget/v1/FeedService.svc
http://nuget.org

我尝试了其他几种配置,即使用 %teamcity.nuget.feed.server% 甚至 %teamcity.nuget.feed.auth.server%。我还尝试使用 NuGet 凭据删除构建功能(因为文档说它不需要使用自托管 NuGet 服务进行身份验证)。也尝试删除 http://nuget.org 源。没有任何效果。

【问题讨论】:

    标签: msbuild nuget teamcity teamcity-9.0


    【解决方案1】:

    TeamCity 中有几个问题:一个是 NuGet 3.3.0 及更高版本:https://youtrack.jetbrains.com/issue/TW-44438,第二个是本地代理:https://youtrack.jetbrains.com/issue/TW-44479。请检查链接的门票。您可以尝试使用较早的 NuGet 版本或尝试workaround

    【讨论】:

      【解决方案2】:

      我认为您的问题是您使用的是 NuGet 3,但包源指向 v2 Feed。

      使用以下包源更新您的“NuGet.config”(C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config):

      <packageSources>
        <add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
      </packageSources>
      

      【讨论】:

        猜你喜欢
        • 2013-07-29
        • 1970-01-01
        • 2022-01-10
        • 1970-01-01
        • 2013-08-13
        • 2015-08-10
        • 2017-07-11
        • 2020-12-05
        • 1970-01-01
        相关资源
        最近更新 更多