TFS 2015构建变量可以访问其他构建变量吗?
当我在新的TFS 2015团队构建中定义自定义变量时,如下所示:
名称:SomeOutput
值:$(System.DefaultWorkingDirectory)\Some
When I define a custom variable in the new TFS 2015 team build as follows:
Name: SomeOutput
Value: $(System.DefaultWorkingDirectory)\Some
...似乎没有扩展$(System.DefaultWorkingDirectory)
.
有办法解决吗?
...it doesn't seems to expand $(System.DefaultWorkingDirectory)
.
Is there a way around this?
至少看来它并没有到处扩展.
At least it seems it's not expanded everywhere.
例如,在MSBuild-Arguments中,/p:OUTPUT="$(SomeOutput)"
扩展为/p:OUTPUT="C:\TfsData\BuildAgents\_work\3\s\Some"
,但是当我添加工具设置为cmd
并且参数设置为/k set
的cmd行构建任务时,它会打印SOMEOUTPUT=$(System.DefaultWorkingDirectory)\Some
For example, in MSBuild-Arguments, /p:OUTPUT="$(SomeOutput)"
is expanded to /p:OUTPUT="C:\TfsData\BuildAgents\_work\3\s\Some"
but when i add a cmd line build task with tool set to cmd
and parameter set to /k set
, it printsSOMEOUTPUT=$(System.DefaultWorkingDirectory)\Some
这是我的变量
EDIT 2:
Here are my variables
这是我的工作流程步骤
This is my workflow step
这是内部版本打印的内容
And this is what the build prints
您可以使用来自Visual Studio市场的VSTS可变任务扩展.
在变量"屏幕中定义变量并将其他变量用作值时,它们将不会扩展(如您所预期的那样).而是将文字文本传递到工作流中的任务.没有这个小任务,以下配置将无法工作:
When you define a variable in the Variables screen and use other variables as value, they won't be expanded (as you may have expected). Instead the literal text is passed to the tasks in the workflow. Without this little task the following configuration won't work:
Variable Value
Build.DropLocation \\share\drops\$(Build.DefinitionName)\$(Build.BuildNumber)
通过在工作流顶部添加Expand Variable(s)任务,它将负责扩展,因此它下面的任何任务都将获得您想要的值.
By adding the Expand variable(s) task to the top of your workflow, it will take care of the expansion, so any task below it will receive the value you're after.
https://github.com/jessehouwing/vsts -variable-tasks/wiki/Expand-Variable
PS:新的代理程序(版本2.x)现在可以自动扩展变量.
PS: The new agent (version 2.x) auto-expands variables now.