简体   繁体   中英

Get Artifact Alias BuildNumber from TFS 2015

referenced here already: How to access an artifact's BUILDNUMBER is Visual Studio Team Services Release management and here: https://docs.microsoft.com/en-us/vsts/build-release/concepts/definitions/release/variables?tabs=batch

I am using vanilla Visual Studio Team Foundation Server 2015 (Version 14.102.25423.0) In my build I zip up an artifact with the buildnumber of the artifact. eg. 20171004.16.zip I have two artifact sources defined in my release definition.

"QA - myproject - build"
"Prod - myproject - build"

One of my steps is to copy the buildnumber.zip file to my remote server. in my configuration setting I have defined:

ProdBuildNumber = $(Release.Artifacts.Prod - myproject - build.BuildNumber)

The issue is that ProdBuildNumber just keeps getting set as that literally. eg: from debug script:

...
2017-10-05T19:09:48.0651172Z [SYSTEM] --> [release]
2017-10-05T19:09:48.0651172Z [PRODBUILDNUMBER] --> [$(Release.Artifacts.Prod - myproject - build.BuildNumber)]
2017-10-05T19:09:48.0651172Z [RELEASE_RELEASEID] --> [114]
...

Can anyone see what I am doing incorrectly? Willing to try any ideas.

尝试

ProdBuildNumber = $(Release.Artifacts.Prod) - myproject - $(build.BuildNumber)

The [Release.Artifacts.Alias.BuildNumber] variable is not available in TFS2015. Upgrade your server to TFS2017 if you want to use it and you can also check all the supported variables from the Release/Logs/Deploy. Following are the supported variables in TFS2015: 在此输入图像描述

If you cannot upgrade the server for now, you can add a powershell script task in your release definition to get the detailed artifact information via Rest API .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM