Azure-pipelines-tasks: FileTransform does not work on standalone json files?

Created on 7 Jan 2020  路  3Comments  路  Source: microsoft/azure-pipelines-tasks

It seems that the latest version of FileTransform requires a webpackage file and will not work on stand alone json files. Would it be possible to update the behavior so that a webpackage is not required?

  • I have tried setting the folder path to

    • folderPath: '$(Build.SourcesDirectory)\tests*'

    • folderPath: '$(Build.SourcesDirectory)\tests**.json'

both of which result in an error

Here is the yaml I have tried

- task: FileTransform@2
  displayName: 'Transform appsettings.json'
  inputs:
    folderPath: '$(Build.SourcesDirectory)\tests\**'
    jsonTargetFiles: |
      $(Build.SourcesDirectory)\tests\**\appsettings.json
      $(Build.SourcesDirectory)\tests\**\appsettings.$(buildConfiguration).json

or

- task: FileTransform@2
  displayName: 'Transform appsettings.json'
  inputs:
    folderPath: '$(Build.SourcesDirectory)\tests\**'
    jsonTargetFiles: |
      appsettings.json
      appsettings.$(buildConfiguration).json

the result I get is

##[section]Starting: Transform appsettings.json
==============================================================================
Task         : File transform
Description  : Replace tokens with variable values in XML or JSON configuration files
Version      : 2.0.4
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/file-transform
==============================================================================
##[error]Error: More than one package matched with specified pattern: d:\a\1\s\tests\**. Please restrain the search pattern.
##[section]Finishing: Transform appsettings.json
Release

All 3 comments

Hi,
I see you've mentioned that "the latest version of FileTransform requires a web package file and will not work on stand-alone JSON files". However, file transform task V1 also always needed a web package file. This is not a new feature.

Thanks -- I realized that after I made the post. If the intention is for this to only work with web packages that maybe the task should be renamed to "Web Package File Transformation"?

@ravensorb We will try to make the task info more useful. Thanks for the feedback.

Was this page helpful?
0 / 5 - 0 ratings