您是否可以在属于另一个VSTS帐户的VSTS Feed中恢复包?

jru*_*ell 5 tfsbuild nuget azure-devops

我公司有很多Visual Studio Team Services帐户.我们有一个用于内部开发,一个用于我们的每个客户.我们在内部开发帐户(https://{dev-account}.visualstudio.com/DefaultCollection)中托管我们的内部nuget库,并且我想在客户端帐户(https://{client-account}.visualstudio.com/DefaultCollection)中运行构建时恢复包.

我使用bootstrap工具设置了存储库,在我的VSTS构建中,我添加了一个Batch Script构建步骤来执行init.cmd.这很好,但是,下一步是NuGet Package Restore,它在dev帐户的NuGet提要中找不到包:

2016-03-22T23:34:37.5398840Z请提供以下网址的凭据:https:// {dev-account} .pkgs.visualstudio.com/DefaultCollection/_packaging/{my-feed} /nuget/v3/index.json

2016-03-22T23:34:37.5408842Z用户名:密码:警告:无法找到包'{my-package}'的版本'1.9.0.10'.

这是有道理的,因为Feed位于单独的VSTS帐户中,并且构建代理无权访问该Feed.

有没有办法解决?我知道MyGet,它提供免费的公共供稿,但如果可能的话,我想使用VSTS.

jru*_*ell 2

我对这个解决方案并不满意,但它确实有效。您可以在 nuget.config 中存储包源的凭据:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <clear />
    <add key="repositoryPath" value="packages" />
  </config>
  <packageSources>
    <!-- When <clear /> is present, previously defined sources are ignored -->
    <!-- Remove this tag or un-comment the nuget.org source below to restore packages from nuget.org -->
    <!-- For more info, see https://docs.nuget.org/consume/nuget-config-file -->
    <clear />
    <add key="vss-package-management" value="https://www.myget.org/F/vss-package-management/api/v2" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="{dev-account}" value="https://{dev-account}.pkgs.visualstudio.com/DefaultCollection/_packaging/{feed}/nuget/v3/index.json" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
  <packageSourceCredentials>
    <{dev-account}>
      <add key="Username" value="username" />
      <add key="ClearTextPassword" value="password" />
    </{dev-account}>
  </packageSourceCredentials>
</configuration>
Run Code Online (Sandbox Code Playgroud)