【发布时间】:2019-12-27 05:24:30
【问题描述】:
TeamCity Professional 2019.1.2(内部版本 66342)
NuGet.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value=".\packages" />
</config>
<packageSources>
<add key="TFS" value="https://tfs.mydomain.com/nuget/nuget" />
</packageSources>
</configuration>
我有一个 .NET CLI (dotnet) restore 构建步骤,包括 Build Feature NuGet feed credentials
从本地 shell 运行时,相应的命令可以正常工作:
> "C:\Program Files\dotnet\dotnet.exe" restore MySolution.sln
> --packages \\packages --source https://tfs.mydomain.com/nuget/nuget --runtime win-x64 --configfile NuGet.config
但在代理上运行的 TeamCity 作业失败并显示 401 unauthorized:
[15:30:52][restore] C:\Program Files\dotnet\sdk\2.2.101\NuGet.targets(114,5): error : Failed to retrieve information about 'Dapper' from remote source 'https://tfs.mydomain.com/nuget/nuget/FindPackagesById()?id='Dapper'&semVerLevel=2.0.0'.
[15:30:52][restore] C:\Program Files\dotnet\sdk\2.2.101\NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized).
我假设 shell dotnet restore 使用我的 Windows 登录凭据 - 正是我的构建功能 NuGet 提要凭据中指定的内容
请注意,我可以在 VisualStudio 中成功使用相同的凭据来管理 NuGet 包(在构建时恢复包)。
【问题讨论】:
-
您可以直接在 teamcity 服务器上的浏览器中打开提要 url
https://tfs.mydomain.com/nuget/nuget吗?据我所知,TFS 服务器上的提要应该以.json或您提供的唯一替代字符结尾?你的 nuget.exe 版本是什么? -
是的,在安装了 TeamCity Server 和 Build Agent 的机器上,我可以在 Internet Explorer(但不是 Firefox)中打开 feed
https://tfs.mydomain.com/nuget/nuget。 IE 似乎已经缓存了我的凭据 - 当我第一次尝试这个时,我可能会被提示输入用户名/密码,但我不记得了。请注意,TFS 凭据与我在 TC 服务器的域登录凭据不同。我在 NuGet.exe v4.7.0.5148
标签: tfs nuget teamcity restore http-status-code-401