AzureDevops任务名称NuGetCommand不明确

AzureDevops任务名称NuGetCommand不明确,azure,azure-devops,azure-pipelines,azure-pipelines-build-task,Azure,Azure Devops,Azure Pipelines,Azure Pipelines Build Task,尝试运行管道时出现以下错误 Job Job: Step task reference is invalid. The task name NuGetCommand is ambiguous. Specify one of the following identifiers to resolve the ambiguity: .NuGetCommand, .NuGetCommand 下面是我的.Net标准库的.yml文件 trigger: - main pool: vmImage:

尝试运行管道时出现以下错误

Job Job: Step  task reference is invalid. The task name NuGetCommand is ambiguous. 
Specify one of the following identifiers to resolve the ambiguity: 
.NuGetCommand, .NuGetCommand
下面是我的
.Net标准
库的
.yml
文件

trigger:
- main

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/MyLibrary.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/MyLibrary.sln'
    feedsToUse: 'config'
    nugetConfigPath: './nuget.config'

- task: VSBuild@1
  inputs:
    solution: '**\MyLibrary.sln'
    vsVersion: '15.0'
    restoreNugetPackages: true
它似乎在抱怨
NugetCommand@2
当它内置时,哪一个没有意义

编辑
也尝试过使用
-任务:333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
而不是
-任务:NuGetCommand@2

可能已使用tfx构建任务上载将一个用户直接推送到帐户中,运行
tfx build tasks list
找出安装了哪些任务,如果需要,使用
tfx build tasks delete
删除非官方任务

C:\Users\jesse>npm install tfx-cli -g
C:\Users\jesse>tfx build tasks list
TFS Cross Platform Command Line Interface v0.8.3
Copyright Microsoft Corporation
> Service URL: https://dev.azure.com/jessehouwing-dev
> Personal access token:
您想要保留的是:

id            : 333b11bd-d341-40d9-afcf-b32d5ce6f23b
name          : NuGetCommand
friendly name : NuGet
visibility    :
description   : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
version       : 2.179.0
如果有一个具有不同guid,则删除将具有:


C:\Users\jesse>tfx build tasks delete --task-id the-task-id-guid-to-delete
它也可能是作为私有共享自定义扩展的一部分推送的。marketplace将阻止具有rame GUID的任务,但它允许通过扩展安装具有相同名称的任务。检查已安装的扩展,尤其是私人共享的扩展

AzureDevops任务名称NuGetCommand不明确

根据错误消息,当Azure DevOps组织中存在两个同名的tasks\extensions时,似乎会发生错误

您可以使用以下REST API:

https://dev.azure.com/{organisationName}/_apis/distributedtask/tasks?visibility%5B%5D=Build
在此处检查可能的重复项

要解决此问题,可以使用命令行调用nuget.exe来还原解决方案:

nuget.exe restore a.sln -source "xx" -PackagesDirectory

谢谢你的快速回复。我还看到它使用了与您提到的333b11bd-d341-40d9-afcf-b32d5ce6f23b相同的ID。我的新任务看起来像“任务:333b11bd-d341-40d9-afcf”吗-b32d5ce6f23b@2输入:命令:“restore”restoreSolution:“**/MyLibrary.sln”feedsToUse:“config”nugetConfigPath:“./nuget.config”``我遇到了一个“字符串,该字符串的模式与”^DataDeployTriggerTask@1$“@mikeg我试图使用
333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
而不是-
NuGetCommand@2
,它成功地工作了。请您编辑您的问题并给出更详细的错误消息好吗?它运行失败并显示错误消息,还是根本没有运行?当我尝试
333b11bd-d341-40d9-afcf时-b32d5ce6f23b@2
我收到此错误消息
字符串与“”的模式不匹配^DataDeployTriggerTask@1$”
这是一个奇怪的错误。。。您能否在整个作业的任何位置共享诊断日志?还是私下分享?看起来您的组织可能已经安装了全局YAML模板……那么,当您运行
tfx构建任务列表时,您会看到什么?您好,这个问题有任何更新吗?请检查jessehouwing的评论是否对您有所帮助,并随时发表评论。