How to access tfs variables from a component using a custom powershell script for Visual Studio Release Management 2013 Release 4.0

对着背影说爱祢 提交于 2019-12-12 01:54:54

问题


My version of Visual Studio 2013 Release Management Client/Server is Release 4.0. I am using the ReleaseTfvcTemplate.12.xaml template. Is there any way to access the system variables from a release management component (deployer configuration) when using an AGENT based release template? I get NULL when I try to pass $applicationPath or $(applicationPath) or $(ApplicationPath).

Here is my status on the deployment of a component in RM that has a custom powershell deployment script:

  1. I can successfully queue a release build
  2. The build output is properly copied to \servername\BuildDrop\
  3. I have an AGENT (not VNEXT) based RM template that gets triggered when the build is completed
  4. The build properly triggers the RM template to release the build
  5. This RM template has one component that gets deployed via a CUSTOM powershell script
  6. The powershell script needs the full absolute path to the builddrop location in order to perform its work (what the powershell script does is not relevant to the discussion) Example: In my deployment configuration for the component in RM, I need to pass the TFS build drop location without having to hardcode it
  7. Based on the MSDN documentation there is a system variable $applicationPath which is hydrated by RM but ONLY when using VNEXT based templates, not Agent based templates
  8. According to an accepted StackOverflow answer here related to accessing system variables from Agent Based RM templates, it would appear the MSDN documentation does not tell the whole story and I should be able to set a line in my component deployment configuration (See below)


回答1:


As Graham mentioned in the comments, the build output is copied locally and it is your working directory when executing your Powershell.

You also can use this to access the build drop location: $(PackageLocation) http://incyclesoftware.zendesk.com/entries/24422737-Deployment-Metadata

Just found a most recent and up to date post from Donovan Brown: http://donovanbrown.com/post/What-are-the-System-variables-for-PS-DSC-deployments-in-Release-Management.aspx



来源:https://stackoverflow.com/questions/28667270/how-to-access-tfs-variables-from-a-component-using-a-custom-powershell-script-fo

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