“找不到版本"在 TFS Build 2015 期间还原 NuGet 包时

编程入门 行业动态 更新时间:2024-10-26 06:25:50
本文介绍了“找不到版本"在 TFS Build 2015 期间还原 NuGet 包时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在 TFS Build 2015 期间还原 NuGet 包时遇到问题.

I'm having troubles with NuGet package restoring during a TFS Build 2015.

由于某些包需要 NuGet 3.x 客户端,我已将新的可编写脚本的构建配置为使用自定义 NuGet 位置,我已在其中放置了 NuGet 命令行 3.x beta 的可执行文件.

Since some packages require NuGet 3.x client, I've configured the new scriptable build to use a custom NuGet location where I've placed the executable of NuGet Command-Line 3.x beta.

每当我运行构建时,所有包都无法恢复,并且 NuGet 会抛出 无法找到版本..." 错误:

Whenever I run a build, all packages can't be restored and NuGet throws the "Unable to find version..." error:

Unable to find version '1.1.10' of package 'Microsoft.Bcl'. Unable to find version '4.0.10' of package 'System.Threading'. Unable to find version '1.1.37' of package 'System.Collections.Immutable'. Unable to find version '1.0.0' of package 'Owin'. Unable to find version '4.1.0' of package 'NLog'. Unable to find version '7.0.1' of package 'Newtonsoft.Json'. Unable to find version '2.0.1' of package 'MongoDB.Driver.Core'. Unable to find version '2.0.1' of package 'MongoDB.Driver'. Unable to find version '2.0.1' of package 'MongoDB.Bson'. Unable to find version '3.0.1' of package 'Microsoft.Owin.Security.OAuth'.

...甚至更多的软件包.我相信这个问题很清楚.

...and even more packages. I believe the issue is clear.

当我使用 Visual Studio 在构建机器中构建相同的解决方案时,所有包都已成功恢复.

When I build the same solution in the build machine using Visual Studio, all packages are restored sucessfully.

我该如何解决这个问题?

How do I solve this?

推荐答案

在我的例子中,问题是用户范围的 NuGet.config 位于 C:Users[Username]AppDataRoamingNuGetNuGet.config(其中 [User name] 是运行构建代理的 Windows 服务的用户)指向 NuGet API v2 而我的构建已经在使用NuGet命令行 3.x.

In my case, the issue was that user-wide NuGet.config located at C:Users[User name]AppDataRoamingNuGetNuGet.config (where [User name] is the user who's running the build agent's Windows service) was pointing to NuGet API v2 while my build is already using NuGet Command-Line 3.x.

<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget" value="api.nuget/v3/index.json" protocolVersion="3" /> <!-- CHANGING V2 TO V3 IN THE URI VALUE SOLVED THE ISSUE! --> <add key="nuget" value="www.nuget/api/v3/" /> </packageSources> </configuration>

更多推荐

“找不到版本"在 TFS Build 2015 期间还原 NuGet 包时

本文发布于:2023-11-16 12:13:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1604176.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   版本   quot   TFS   Build

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!