我正在使用TFS 2017和NuGet Installer - 0任务进行构建定义中的NuGet还原,但得到一个错误的信息 找不到版本.
它使用下面的命令来恢复软件包。
D:\agent\_work\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe restore -NonInteractive D:\agent\_work\42\s\xyz\xyz.sln -Verbosity Detailed
Unable to find version '3.2.7' of package 'Microsoft.AspNet.WebPages'.
2020-06-15T14:50:36.6499535Z Unable to find version '5.2.7' of package 'Microsoft.AspNet.WebApi.WebHost'.
2020-06-15T14:50:36.6499535Z Unable to find version '5.2.7' of package 'Microsoft.AspNet.WebApi.Core'.
2020-06-15T14:50:36.6499535Z Unable to find version '5.2.7' of package 'Microsoft.AspNet.WebApi.Client'.
2020-06-15T14:50:36.6499535Z Unable to find version '5.2.7' of package 'Microsoft.AspNet.Mvc'.
但当我在代理上手动运行相同的上述命令时,它工作正常,也尝试更新NuGet任务版本。
无法找到包xxx的版本'3.2.7'。
同意Etienne的观点。这些软件包的版本可以在 nuget.org
.
当您使用 Nuget Restore task
在TFS2017中,你可以尝试以下方法来使用nuget.org。
Nuget Restore task
V1. 选择 Use Packages from nuget.org
选项。如果你使用的是nuget.config文件,你可以在其中添加 nuget.config
文件中的包源。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json"protocolVersion="3" />
</packageSources>
</configuration>
这里有一个关于 nuget.config文件.
希望这能帮助你。
我们从今天早上(2020年6月16日)开始在我们的一个项目上遇到了同样的问题,我们需要升级我们的Nuget.exe.我可以看到你正在使用Nuget 3.3,当前的推荐版本是5.5.1。
好像是通过npm包安装的。
D:\agent\_work\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe
最新版本在这里。https:/www.nuget.orgdownloads
换成最新的稳定版就可以了。😁
EDIT:旧版Nuget不能用的原因是GitHub放弃了对TLS 1.0和1.1的支持。