On a pipeline, I have two powershell tasks that read variables from different files, and I want to copy those variables into the same environment variable. This design is being used across multiple pipelines, and I can't change it.
The following code in the powershell script is used for that effect, which copies the variables read from the file, contained in the fileParameters
object, into the envParameters
object:
Write-Host "##vso[task.setvariable variable=envParameters;]$($fileParameters)"
The above would work well if I would be executing the task once. But since the task is executed twice, the second execution deletes all the envParameters
properties read in the first script execution. Is there a way to update envParameters
without deleting the already existing properties?