本文介绍了如何获取TFS2015 Build(Build.vnext)和NuGet软件包还原以使用自定义软件包源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取我们的TFS2015构建( TFSBuild vnext )与VS Team Services一起使用.

I'm trying to get our TFS2015 Build (TFSBuild vnext) going along with VS Team Services.

因此最多博客和文档很有帮助,除了尝试构建使用自定义软件包源进行NuGet自动软件包还原的项目时.

Thus far most blogs and documentation has been helpful, except for when trying to build a project that uses custom package sources for NuGet automatic package restore.

我已经成功部署了一个Team Services Build Agent(构建的新机制),并且在还原NuGet软件包的构建任务失败之前,一切似乎进展顺利.

I've successfully deployed an a Team Services Build Agent (the new mechanism for builds) and all seemed to go well until the build task to Restore NuGet packages failed.

失败是由于未从已安装的VS配置中获取自定义/私有程序包源,因此找不到这些程序包.默认的NuGet程序包提要中的传统程序包确实可以正常恢复.

The failure was due to custom/private package source not being picked up from the installed VS configuration, so those packages could not be found. The traditional packages from the default NuGet package feed did restore without issue.

在使用代理时,如何指定供NuGet使用的其他软件包来源?

How do I specify the additional package sources for NuGet to use when using an agent?

vcastro询问了有关NuGet Installer构建步骤以及在该构建步骤的配置中定义路径的问题.上面使用的是Visual Studio Build步骤和集成选项,以具有NuGet还原程序包.请将此图像用作参考:

vcastro asked about the NuGet Installer build step and defining paths in the configuration of that build step. The above is using the Visual Studio Build step and the integrated option to have NuGet restore packages. Refer this image for reference:

推荐答案

我在网络上取得了很小的成功,但是摆弄以下内容会有所帮助:

I've scrounged the web with little success, but after fiddling the following will help:

OK似乎为NuGet.config配置的软件包源是按用户帐户存储的,例如

OK It seems that the package sources configured for NuGet.config is stored per user account, e.g.

c:\Users\<<username>>\AppData\Roaming\NuGet\NuGet.config

我的问题很难解决,因为构建代理在Local System帐户下以Windows Service身份运行.因此,要获取用于构建的NuGet配置,我必须改用以下路径:

My issue was harder to resolve, because the build agent was running as a Windows Service under the Local System account. So to get NuGet configuration to for the build, I had to use the following path instead:

  • 64位Windows C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
  • 32位Windows C:\Windows\System32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
  • 64-bit Windows C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
  • 32-bit Windows C:\Windows\System32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config

您可能需要具有提升的权限才能创建 NuGet 子文件夹和 NuGet.Config 文件.

You may need to have elevated permissions in order to create the NuGet subfolder and NuGet.Config file.

注意:我没有使用Local Service帐户的解决方案.以上仅适用于Local System(或实际用户)帐户.

Note: I have no solution for using the Local Service account. The above only works for the Local System (or an actual user) account.

这篇关于如何获取TFS2015 Build(Build.vnext)和NuGet软件包还原以使用自定义软件包源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-03 20:45