I inserted the following variable in the library
mymultilinevar\ncontaininganewline
When I file transform the following string is inserted
mymultilinevar\\ncontaininganewline
How can I prevent this? Regards,
I inserted the following variable in the library
mymultilinevar\ncontaininganewline
When I file transform the following string is inserted
mymultilinevar\\ncontaininganewline
How can I prevent this? Regards,
You can follow below steps to fix this.
1, Use a delimiter(eg, ;) instead of \n to divide the new line in your multiline variable.
For example. Define your variable(eg.myVariable in below example) as mymultilinevar;containinganewline
2, Add a script task before File Transform task to replace ; with %0A (which is the hexadecimal value of \n).
And update your variable(myVariable) with the replaced value. See below example scripts in powershell task:
$muline = "$(myVariable)" -replace ";", "%0A"
Write-Host "##vso[task.setvariable variable=myVariable]$($muline)"
See document Set variables in scripts about statement ##vso[task.setvariable]
3, Then run File Transfom task, the variable should be replaced with mymultilinevar\ncontaininganewline