You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Visual Studio Test Platform Installer中使用Azure服务连接?

解决VisualStudioTestPlatformInstaller@1使用NuGet服务连接的问题

你当前的配置错误在于:VisualStudioTestPlatformInstaller@1的customFeed参数不支持直接填写服务连接名称,它需要的是NuGet源的具体URL(或者Azure Artifacts的项目名/Feed名格式),而服务连接的认证需要单独通过NuGetAuthenticate@0任务来完成。

以下是两种可行的解决方案:

方案一:针对Azure Artifacts NuGet源

  1. 先添加NuGetAuthenticate@0任务,通过你的服务连接注入认证凭证
  2. 在VisualStudioTestPlatformInstaller@1中填写Azure Artifacts Feed的名称或完整URL

示例YAML配置:

- task: NuGetAuthenticate@0
  displayName: 'NuGet 认证'
  inputs:
    nuGetServiceConnections: 'my_service_connection_to_nuget'

- task: VisualStudioTestPlatformInstaller@1
  displayName: 'Visual Studio Test Platform Installer'
  inputs:
    packageFeedSelector: customFeed
    # 两种填写方式二选一:
    customFeed: '你的项目名/你的Feed名' # 比如MyTestProject/MyTestFeed
    # 或者填完整的Feed URL:https://pkgs.dev.azure.com/你的组织名/你的项目名/_packaging/你的Feed名/nuget/v3/index.json

方案二:针对外部私有NuGet源(如自建NuGet服务器)

  1. 同样先添加NuGetAuthenticate@0任务关联你的服务连接
  2. customFeed填写外部NuGet源的完整URL
  3. 确保你的服务连接类型为NuGet,且已配置正确的用户名/密码或API密钥

示例YAML配置:

- task: NuGetAuthenticate@0
  displayName: 'NuGet 认证'
  inputs:
    nuGetServiceConnections: 'my_service_connection_to_nuget'

- task: VisualStudioTestPlatformInstaller@1
  displayName: 'Visual Studio Test Platform Installer'
  inputs:
    packageFeedSelector: customFeed
    customFeed: 'https://your-private-nuget-server/v3/index.json'

备选方案:使用官方NuGet源

如果你的场景不需要私有源,直接切换到官方NuGet源即可,无需配置服务连接:

- task: VisualStudioTestPlatformInstaller@1
  displayName: 'Visual Studio Test Platform Installer'
  inputs:
    packageFeedSelector: nugetOrg

内容的提问来源于stack exchange,提问作者bomtom

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 11:35:12