TFS 2017 - 是否可以在同一版本的另一个环境中设置的环境中访问发布变量?

TFS 2017 - Is it possible to access the release variable in an environment which was set in another environment in the same release?

在 TFS 2017 中,我在执行期间使用以下命令在第一个环境中设置了一个变量

$myValue="myValue"

Write-Host ("##vso[task.setvariable variable=myValue;]$myValue")

是否可以在同一版本的第二个环境中访问此变量?

不,您使用的是 环境级别 变量,该变量的值 因环境而异 (对于环境中的所有任务)。

然而,这是可以实现的,你只需要使用发布定义变量代替。

Share values across all of the environments by using release definition variables. Choose a release definition variable when you need to use the same value across all the environments and tasks in the release definition, and you want to be able to change the value in a single place. You define and manage these variables in the Variables tab in a release definition.

有关发布管理中变量的更多详细信息,请参阅此tutorial