Nuget 您能否还原属于另一个VSTS帐户的VSTS源中的包?

Nuget 您能否还原属于另一个VSTS帐户的VSTS源中的包?,nuget,tfsbuild,azure-devops,Nuget,Tfsbuild,Azure Devops,我的公司有许多Visual Studio团队服务客户。我们有一个用于内部开发,每个客户都有一个。我们在内部开发帐户(https://{dev account}.visualstudio.com/DefaultCollection)中托管我们的内部nuget库,我希望在客户端帐户(https://{client account}.visualstudio.com/DefaultCollection)中运行构建时恢复包 我使用设置了存储库,并在我的VSTS构建中添加了一个批处理脚本构建步骤,执行in

我的公司有许多Visual Studio团队服务客户。我们有一个用于内部开发,每个客户都有一个。我们在内部开发帐户(
https://{dev account}.visualstudio.com/DefaultCollection
)中托管我们的内部nuget库,我希望在客户端帐户(
https://{client account}.visualstudio.com/DefaultCollection
)中运行构建时恢复包

我使用设置了存储库,并在我的VSTS构建中添加了一个批处理脚本构建步骤,执行
init.cmd
。这很好,但是,下一步是NuGet Package Restore,它在开发人员帐户的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”

这是有意义的,因为提要位于单独的VSTS帐户中,并且构建代理没有访问提要的权限


这有什么关系吗?我知道MyGet,它提供免费的公共提要,但如果可能的话,我想使用VST。

我对这个解决方案不感兴趣,但它很管用。您可以在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>