简体   繁体   English

使用旧版本 NuGet.exe 的 TFS On-Prem 构建代理

[英]TFS On-Prem Build Agent Using Old Version Of NuGet.exe

We are hosting TFS 2017 Update 2 on-prem, and using on-prem build agents.我们在本地托管 TFS 2017 Update 2,并使用本地构建代理。 The latest version of NuGet.exe is currently 4.3.0, but our build agents always default to using v4.0.0. NuGet.exe 的最新版本目前是 4.3.0,但我们的构建代理始终默认使用 v4.0.0。 How can I get our build agents to use the latest version of NuGet.exe?如何让我们的构建代理使用最新版本的 NuGet.exe?

We need to update because NuGet restore is failing when using v4.0.0, but works with v4.3.0, since we are dealing with new .Net Standard 2.0 packages.我们需要更新,因为NuGet restore在使用 v4.0.0 时失败,但适用于 v4.3.0,因为我们正在处理新的 .Net Standard 2.0 包。 On our build server I was able to do NuGet.exe update -self to update the NuGet.exe found at C:\\Builds\\_work\\_tool\\NuGet\\4.0.0\\x64\\nuget.exe from 4.0.0 to 4.3.0, but that C:\\Builds\\_work\\_tool directory regularly gets deleted and recreated, so this isn't a persistent workaround.在我们的构建服务器上,我能够执行NuGet.exe update -self以将位于C:\\Builds\\_work\\_tool\\NuGet\\4.0.0\\x64\\nuget.exe从 4.0.0 更新到 4.3。 0,但是C:\\Builds\\_work\\_tool目录会定期被删除和重新创建,所以这不是一个持久的解决方法。

How can I get our build agents to always use the latest version of NuGet.exe, or at least v4.3.0?如何让我们的构建代理始终使用最新版本的 NuGet.exe,或者至少是 v4.3.0?

我知道你不应该用链接回答,但这篇文章提供了你需要的所有细节,确认任务确实仍然使用 4.0.0,如何使用 VSTS 和 TFS 2018 你不必担心关于这个(有一个新的 NuGet 安装程序任务)以及如何通过 PowerShell 脚本为 VS 2017.2(及更早版本)重新创建这种任务, 在你的构建中使用最新的 NuGet

Based on Greg's linked answer, but a little bit simpler:基于 Greg 的链接答案,但更简单一点:

  1. Add a step "NuGet Tool Installer" before the other NuGet steps, use ">=5.0.0" for the version and mark "Always download the latest matching version", this should - well - give you the latest stable version在其他 NuGet 步骤之前添加一个步骤“NuGet 工具安装程序”,版本使用“>=5.0.0”并标记“始终下载最新匹配版本”,这应该 - 好吧 - 为您提供最新的稳定版本
  2. Replace the existing "NuGet Installer" steps - this seems to be the default with "NuGet Restore" steps, just copying the settings.替换现有的“NuGet 安装程序”步骤 - 这似乎是“NuGet 恢复”步骤的默认设置,只需复制设置。 They seem to be totally compatible, allowing eg for package config or solution files to be referenced, including pattern matching它们似乎完全兼容,例如允许引用包配置或解决方案文件,包括模式匹配

NuGet TFS 步骤

That is it.就是这样。 Replacing the "NuGet Installer" that requires you to specify a version with the "NuGet Restore" that just uses the NuGet.exe from the path as set in "NuGet Tool Installer" is easier.将需要您指定版本的“NuGet 安装程序”替换为仅使用“NuGet 工具安装程序”中设置的路径中的 NuGet.exe 的“NuGet 还原”更容易。 Also mind the confusing naming (NuGet Tool Installer/NuGet Installer - the two are rather different).还要注意令人困惑的命名(NuGet 工具安装程序/NuGet 安装程序 - 两者相当不同)。

Having to tinker so much with the not so old TFS 2017 infrastructure is a shame.不得不对不太老的 TFS 2017 基础设施进行如此多的修补是一种耻辱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Tfs build agent文件夹中众多NuGet.exe版本背后的原因是什么? - What is the reason behind the multitude of NuGet.exe versions within the Tfs build agent folder? TFS(本地)构建代理(本地)在作为服务运行时未找到 Visual Studio 2017 功能 - TFS(On-Prem) Build Agent(On-Prem) Not Finding Visual Studio 2017 Capability While Running As Service 是否可以为本地TFS 2018设置代理发布代理? - Is it possible to setup a proxy release agent for on-prem TFS 2018? TFS构建/发布代理“更新所有代理”并未更新2017年TFS内部代理 - TFS build/release agents “update all agents” is not updating the agents for TFS on-prem 2017 试图击中nuget.org的生成机上的NuGet.exe包 - NuGet.exe pack on build machine trying to hit nuget.org TFS2017本地-构建网页空白并且图像不显示 - TFS2017 On-Prem - Build Web page is blank & images not showing 在 TFS 版本中找不到 NuGet package 版本? - Unable to find NuGet package version in TFS build? TFS 2013 Build Agent目标.NET版本 - TFS 2013 Build Agent target .NET version 将代码从VSTS存储库推送到本地TFS? - Push code from VSTS repository to on-prem TFS? JetBrains Rider - 连接到本地 TFS 时出错 - JetBrains Rider - errors when connecting to on-prem TFS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM