Since I'm getting The FileTransform@1 task is deprecated, please use a newer version of the FileTransform task
warning for my pipelines I updated FileTransform@1
to FileTransform@2
See the code below.
- task: FileTransform@2
displayName: 'Update the parameters in azuredeploy.web.parameters.json'
inputs:
folderPath: '**/'
targetFiles: '**/azuredeploy.web.parameters.json'
fileType: json
But that failed with error Cannot perform XML transformations on a non-Windows platform
when it's an Json transformation.
Found out by trial and error that if you only want JSON variable substitution, you need to explicitly specify the "xmlTransformationRules", but leave it blank in order to disable XML transformations:
- task: FileTransform@2
displayName: 'Update appSettings.json'
inputs:
folderPath: '**/'
xmlTransformationRules:
jsonTargetFiles: 'appSettings.json'
I saw in documentation that in version @2 the xmlTransformationRules
has a default value, even if I don't use it. So I gave it empty string ''. I think it tries behind the scene to do some xml File Transformations, and sometimes you only need Variables Substitution.
folderPath
field I would say its where the azuredeploy.web.parameters.json
resides.
- task: FileTransform@2
displayName: Transform appsettings file
inputs:
folderPath: './src/MyProject/folder'
xmlTransformationRules: ''
jsonTargetFiles: '**/azuredeploy.web.parameters.json'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With