无法将多行字符串设置为环境变量

问题描述:

如何在 VSTS powershell 任务中将多行字符串设置为环境变量.以下代码只保存字符串的第一行.

How can I set multi line string to environment variable on VSTS powershell task. Following code only save the first line of the string.

[string]$xmlstring = Get-Content -Encoding UTF8 -Path"$(System.DefaultWorkingDirectory)/apiPolicy.xml" -Raw |外串;写主机(##vso[task.setvariable variable=policystring;]"+$xmlstring)

不支持 build 或 release 中的多行变量,因此在 build/release 时也不能设置多行变量.

Multiple lines variable in build or release is not supported, so it can’t be set the multiple variable during the build/release too.

相关用户声音:构建和发布中的多行变量.

使用 base64 字符串是个好方法.

To do it with the base64 string is the good way.