TFS How to GetEnvironmentVariable value

好久不见. 提交于 2019-12-18 09:38:43

问题


In my tfs build I've created an argument to which I pass in $(TF_BUILD_BUILDDIRECTORY)

Then in my xaml file I've added a variable called "test1" and added GetEnvirenmentVariable" step where I would like to store value of

TF_BUILD_BUILDDIRECTORY

I can NOT get the value to come through. Output from my build:

It prints $(TF_BUILD_BUILDDIRECTORY) instead of "C:\temp... etc"

Please help! thanks


回答1:


Refer to the last paragraph in 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


Please follow the below steps:

  1. Create a String variable named: BINARIESDIRECTORY.
  2. Add GetEnvironmentVariable (String) activity, set Name = Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory and Result = BINARIESDIRECTORY
  3. Add CopyDirectory activity, set Source = BINARIESDIRECTORY and Destination = “\servername\drop”


来源:https://stackoverflow.com/questions/34867042/tfs-how-to-getenvironmentvariable-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!