TheDude
TheDude

Reputation: 1531

Replace Tokens Task Ambiguity Issue in Azure YAML pipeline

I’m having some namespace conflict issues with a particular task in the YAML pipeline for Azure. Here's the code for the "replace tokens" task I'm having issues with:

      - task: replacetokens@4
        displayName: Replace tokens in localSettings.xml
        inputs:
          rootDirectory: '$(System.DefaultWorkingDirectory)\path_to_tests'
          targetFiles: 'localSettings.xml'
          encoding: 'auto'
          tokenPattern: 'default'
          writeBOM: true
          actionOnMissing: 'warn'
          keepToken: false
          actionOnNoFiles: 'continue'
          enableTransforms: false
          useLegacyPattern: false
          enableTelemetry: true

It works fine at compile time. No issues. However, I get this runtime error when I try to run the pipeline:

Job DEV_Tests: Step task reference is invalid. The task name replacetokens is ambiguous. Specify one of the following identifiers to resolve the ambiguity: qetza.replacetokens.replacetokens-task.replacetokens, colinsalmcorner.colinsalmcorner-buildtasks.replace-tokens-task.ReplaceTokens

It seems to me that there's multiple versions of "replacetokens@4" which is why I get this ambiguous error. However, when I try to use either the "qetza" or "colinsalmcorner" namespaces as advised in the error, I get another compile time error suggestion that those namespaces don't exist:

String does not match the pattern of "^UseRubyVersion@0$".

Value is not accepted. Valid values: "UseRubyVersion@0", "deployApi@3", "deployApi@4", "deployApi@5", "ReviewApp@0", "AzureAPIImport@1", "AzureAPIImport@3", "AzureAPIImport@4", "AzureAPIImport@5", "AzureAPIImport@6", "AzureAPIUrlImport@0", "AzureAPIImport@2", "AppCenterDistribute@2", "AppCenterDistribute@3", "AppCenterDistribute@1", "AppCenterDistribute@0", "CopyFiles@2", "C

Any ideas why those namespaces aren't recognized in the pipeline and yet "replacetokens@4" is recognized with a namespace conflict?

Upvotes: 2

Views: 3975

Answers (1)

Krzysztof Madej
Krzysztof Madej

Reputation: 40829

I checked this and what I get when I use full namespace is just a warning like this:

enter image description here

This is probably schema used for validation doesn't allow to use full names, however this is just a warning.

When I validate pipeline I got OK.

enter image description here

Upvotes: 1

Related Questions