问题
I've declared a user capability named "MyCapability" in a TFS 2015 build agent with a path as value. How can I get this value in the powershell script of my build task ?
$env:MyCapability
and $MyCapability
don't work.
回答1:
You cannot access the capabilities from PowerShell through a variable unfortunately.
You could use the Rest Client to connect back to TFS and read the Build Agent as well as the Build Definition to read out the configured values. This will require access to the OAuth token, which can be configured through a checkbox on the Build Definition's configuration page.
来源:https://stackoverflow.com/questions/39206539/how-to-get-an-agent-user-capability-in-tfs-build-task