Open soundd2 opened 1 month ago
Hi @soundd2,
Based on your screenshot you are using the syntax {{ ... }}
to mark your token in your file. This is not the default pattern of the task. You have 2 options:
- task: replacetokens@6
inputs:
root: '$(System.DefaultWorkingDirectory)'
sources: 'appsettings.json'
tokenPattern: doublebraces
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="#{ TestSettings_Name }#">
//...
</TestSettings>
Thank you , it worked
I have done Testing “replacement token” test on simple yaml file with MS agent. which is YAML below: I have used MS agent
all tasks succeeded but not sure why it is not replaced and showing as test02 it is in last task which “print after file replace”
YAML file:
Starter pipeline
Start with a minimal pipeline that you can customize to build and deploy your code.
Add steps that build, run tests, deploy, and more:
https://aka.ms/yaml
trigger:
pool: vmImage: ubuntu-latest
parameters:
stages:
stage: A jobs:
task: Bash@3 displayName: 'Print file before replace' inputs: targetType: inline script: 'cat $(System.DefaultWorkingDirectory)/appsettings.json'
task: Bash@3 inputs: targetType: 'inline' script: 'echo $(TestSetting_Name)'
task: Bash@3 inputs: targetType: 'inline' script: 'cat $(System.DefaultWorkingDirectory)/appsettings.json'
task: replacetokens@6 inputs: root: '$(System.DefaultWorkingDirectory)' sources: 'appsettings.json'
task: Bash@3 displayName: 'Print file after replace' inputs: targetType: inline script: 'cat $(System.DefaultWorkingDirectory)/appsettings.json'
File from code where it has to replace:
Logs:
logs_1346.zip
Please suugest