问题
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:
- I can successfully queue a release build
- The build output is properly copied to \servername\BuildDrop\
- I have an AGENT (not VNEXT) based RM template that gets triggered when the build is completed
- The build properly triggers the RM template to release the build
- This RM template has one component that gets deployed via a CUSTOM powershell script
- 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
- 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
- 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