Visual Studio Team Foundation Server 2015 发布配置变量未设置 [英] Visual Studio Team Foundation Server 2015 release configuration variables not setting

查看:17
本文介绍了Visual Studio Team Foundation Server 2015 发布配置变量未设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 powershell 步骤中考虑以下事项:

-source "c:\builds\$(Build.BuildNumber).zip"

结果是c:\builds\20171005.1.zip"

如果我尝试像这样在我的发布变量的配置选项卡中设置以下内容名称=MyBuildNumber 值=$(Build.BuildNumber)

如果我把我的 poweshell 改成这样

-source "c:\builds\$(MyBuildNumber).zip"

结果是c:\builds\$(Build.BuildNumber).zip"

我在这里做错了什么?我尝试了几种不同风格的存储变量,它们都具有相同的效果.真的可以使用一些建议.

---------根据 ANDY-MSFT----我可以确认我使用的是版本 14.102.25423.0.我安装了可变扩展包..没有区别.日志显示文字输出.我很确定我正在使用与您完全相同的设置.请检查我的定义变量和 powershell 语法的屏幕截图.

解决方案

TFS 2015 的确切版本是什么,您使用的是哪个版本?

我在 TFS 2015 Update4(Version 14.114.26403.0Agent.Version:1.95.4)上进行了测试,一切正常.

所以,请检查

consider the following in my powershell step:

-source "c:\builds\$(Build.BuildNumber).zip"

result is "c:\builds\20171005.1.zip"

If I try and set the following in the configuration tab of my release variables of release like this Name=MyBuildNumber Value=$(Build.BuildNumber)

If I change my poweshell to look like this

-source "c:\builds\$(MyBuildNumber).zip"

result is "c:\builds\$(Build.BuildNumber).zip"

What am I a doing wrong here? I have tried a few different flavours of stored variables all with the same effect. Could really use some advice.

---------AS PER ANDY-MSFT---- I can confirm I am using Version 14.102.25423.0. I installed the variable extension pack.. no difference. The logs show the literal output. I am pretty sure I am using the exact same setup you are. Please check the screenshot of my definition variable and powershell syntax.

解决方案

What's the exact version of TFS 2015 and the anent version do you use?

I tested on TFS 2015 Update4 (Version 14.114.26403.0, Agent.Version:1.95.4), everything works as expected.

So, please check What version of Team Foundation Server do you have, if you are using earlier version, you can try to upgrade to Update4 or later version, then try it again.

Besides, if you still want to keep your current version, you can use the VSTS Variable Tasks extension: Variable Toolbox to expand the build/release variables. (And the source code here for your reference.)

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)

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.

PS: The new agent (version 2.x) auto-expands variables now.

And this similar thread for your reference: TFS 2015 Can build variables access other build variables?


UPDATE:

Based on your TFS version, it should be TFS 2015 update3 (You can upgrade to Update4 or later version if that's an option, also upgrade the build Agent accordingly). To check the agent version : Go Manager Server (gear icon) >> AgentPool >> Select a pool >> select an agent >> Switch to Capabilities, you will see the agent version in that page.

这篇关于Visual Studio Team Foundation Server 2015 发布配置变量未设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆