Msbuild 如何设置TeamCity以使用自己的HTTP认证NuGet服务?

Msbuild 如何设置TeamCity以使用自己的HTTP认证NuGet服务?,msbuild,nuget,teamcity,teamcity-9.0,Msbuild,Nuget,Teamcity,Teamcity 9.0,一个问题是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/

一个问题是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服务进行身份验证)。也尝试删除源代码。什么都不管用

TeamCity中存在几个问题:一个是NuGet 3.3.0及更高版本:另一个是本地代理:。请检查链接的车票。您可以尝试使用早期的NuGet版本或尝试。

我认为您的问题在于您使用的是NuGet 3,但包源指向v2提要

使用以下软件包源更新“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>