We want to use TFS 2015.3 Release Management for Packaging/Deploying our Software. For one of our Release Tasks we need access to the Release Artifact Variables in one of our Powershell Scripts.
But everytime we try to access one of those variables RELEASE_ARTIFACTS_[source-alias]_BUILDNUMBER for example, we receive the following error message:
[error] The term 'Release_Artifacts_[source-alias]_BUILDNUMBER' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I've already tried to print out all available Environment Variables by using an inline powershell script with the following statement: Get-ChildItem Env:. But those variables weren't there anyway..
Are there any known issues when using Release Artifact variables?
It seems that the Release Artifacts variables are not available for TFS on-prem; I tested the same script with VSTS and with TFS2015.3.
In VSTS release you can see the release variables in the Initialize step while in on-prem release these variables are missing:
You are using the pre-defined variables of the form with Release Management Artifacts:
RELEASE_ARTIFACTS_[source-alias]_[variable-name]
You need to replace [source-alias]
with the name of the alias for the artifact source included in the release definition. You can find the alias name in the Artifacts tab of a release definition.
Then you could use it as below:
env:RELEASE_ARTIFACTS_[ScrumProject]_[BUILDNUMBER]
Release.Artifacts.[source-alias].[variable-name]
More details please refer this tutorial page from MSDN: Artifacts in Microsoft Release Management
After some test, got the same result as ds19. Seems release artifacts is not support for TFS2015 update3 only work with VSTS for now.
Update
You just need to specify build.artifactstagingdirectory
in Publish Build Artifacts or Copy and Publish Build Artifacts step, TFS will do the thing for you. To zip the artifacts you can also use a powershell script to achieve this, more detail info you can refer this blog Manage Artifacts with TFS Build vNext
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With