TFS如何获取环境变量值
TFS How to GetEnvironmentVariable value
在我的 tfs 构建中,我创建了一个参数,我将其传入 $(TF_BUILD_BUILDDIRECTORY)
然后在我的 xaml 文件中,我添加了一个名为 "test1" 的变量,并添加了 GetEnvirenmentVariable" 步骤,我想在其中存储
的值
TF_BUILD_BUILDDIRECTORY
我无法获得通过的价值。我构建的输出:
It prints $(TF_BUILD_BUILDDIRECTORY) instead of "C:\temp... etc"
请帮忙!
谢谢
参考this MSDN document最后一段:
Use environment data from a custom build process
If you need to use an environment variable in your custom build
process template, you can use the GetEnvironmentVariable
activity to
get the data. You can get data from any of the
WellKnownEnvironmentVariables.
For example, to get the path to the binaries directory, set the Name
property of the GetEnvironmentVariable
activity to
Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory
请按照以下步骤操作:
- 创建一个名为:BINARIESDIRECTORY 的字符串变量。
- 添加
GetEnvironmentVariable (String)
activity,设置名称=Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory
和 结果 = BINARIESDIRECTORY
- 添加
CopyDirectory
activity,设置 Source = BINARIESDIRECTORY 和
目的地 =“\servername\drop”
在我的 tfs 构建中,我创建了一个参数,我将其传入 $(TF_BUILD_BUILDDIRECTORY)
TF_BUILD_BUILDDIRECTORY
我无法获得通过的价值。我构建的输出:
It prints $(TF_BUILD_BUILDDIRECTORY) instead of "C:\temp... etc"
请帮忙! 谢谢
参考this MSDN document最后一段:
Use environment data from a custom build process
If you need to use an environment variable in your custom build process template, you can use the
GetEnvironmentVariable
activity to get the data. You can get data from any of the WellKnownEnvironmentVariables.For example, to get the path to the binaries directory, set the Name property of the
GetEnvironmentVariable
activity toMicrosoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory
请按照以下步骤操作:
- 创建一个名为:BINARIESDIRECTORY 的字符串变量。
- 添加
GetEnvironmentVariable (String)
activity,设置名称=Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory
和 结果 = BINARIESDIRECTORY - 添加
CopyDirectory
activity,设置 Source = BINARIESDIRECTORY 和 目的地 =“\servername\drop”