本文介绍了VSTS Build vNext NuGet自定义包源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Azure企业协议,其中主要订阅是VSTS帐户绑定到的.我们已经设置了程序包管理"扩展,以便为不同的项目托管一些有用的程序包.对于每个客户,我们在此EA中创建一个订阅,并为其绑定一个VSTS帐户.我们在后一个订阅的托管构建代理上构建我们的客户项目.但是,当构建过程需要恢复存储在主软件包提要中的NuGet软件包(使用Nuget Installer任务)时,看起来构建服务无法访问此提要(可能是因为它不是同一预订的一部分).

是否有一种方法可以在主供稿权限中允许外部构建服务,或者甚至可以在客户构建定义的NuGet安装程序任务中使用api密钥,以便能够从主供稿中还原软件包?/p>

我尝试将特定的nuget.config与 apiKey (使用在我的开发机上本地设置的相同api密钥)一起使用i> packageSourceCredentials 标签.2个都不让构建代理还原软件包.

构建代理截图(COETools.Testing来自另一个订阅上的自定义feed)

nuget.config

我将构建任务更改为使用提供的默认代理nuget.exe(我以前在源代码管理中使用的是一个代理),并且设法将nuget官方提要中的软件包还原了.但是我仍然无法通过自定义供稿中的一个来还原.

解决方案

好的,我可以使用它,但是我不喜欢这样做,因为我必须在中使用我的个人访问令牌. packageSourceCredentials 标签.

这是我使用的nuget.config:

一种更好的方法是使用API​​密钥(作为在开发本地计算机nuget.config中生成的密钥,而不是个人访问令牌.

We have an Azure Entreprise Agreement with a main subscription to which a VSTS account is bound. We have setup the Package Management extension in order to host some usefull packages for diferent projects. For each customer, we create a subscription in this EA and a VSTS account bound to it. We build our customer projects on the Hosted build agent of the latter subscription.But when it's time for the build process to restore NuGet packages (using Nuget Installer task) that are stored on the main package feed, it looks like that the build service cannot access this feed (probably because it's not part of the same subscription).

Is there a way to allow an external build service in the main feed permissions, or even use an api key in the NuGet Installer task of the customer build definition, in order to be able to restore packages from the main feed ?

EDIT: i tryed to use a specific nuget.config with either the apiKey (with the same api key that is locally set on my dev machine) or the packageSourceCredentials tag. None of the 2 let the build agent restore the packages.

EDIT: build agent screenshot (COETools.Testing comes from custom feed on another subscription)

EDIT: nuget.config

EDIT: I changed the build task to use the default agent supplied nuget.exe (i was previously using one in source control) and i managed to have the packages from nuget official feed to be restored. But i'm still unable to have the one from custom feed to restore.

解决方案

OK, i had it to work, but i don't like the way i did it because i had to use my personal access token in the packageSourceCredentials tag.

Here is the nuget.config i used:

A better way to do it would be to use the API key (as the one that is generated in the dev local machine nuget.config instead of the personal access token.

这篇关于VSTS Build vNext NuGet自定义包源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:02