2

I'm trying to write a powershell script to allow a user to specify a tfs build id (or alternately a changeset id) and download the build output to the current directory. I have the build configured to copy the output to the server, which means only the most recent build output will be accessible in that directory. However from Visual Studio, or from the TFS Web Access, I can download the drop as a .zip file.

How can I access this .zip file programmatically (either in powershell, or even if I could figure out VB code to do this I can convert it to a powershell script)? Am I thinking about build output wrong, and there's a easier, more obvious way to handle this? Is the build output of the older builds being stored somewhere else on the server, or is it store in the database? Should I be configuring the build differently to store each build in a separate folder rather than overwriting each build in a single folder?

1 Answer 1

1

You can access the download zip via a properly constructed URL. For example:

https://{AccountName}.visualstudio.com/DefaultCollection/{TeamProject}/_apis/build/builds/{BuildId}/artifacts/drop?%24format=zip
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Dylan! Is that supposed to work for TFS 2013 on-premise? It didn't for me, but you did help me down the right path. TFS Web Access doesn't have any mechanism to see the download url, but I sniffed the network traffic to figure out a slightly different url format that does work: http://{MyTFSServer}/{TeamProjectCollection}/{TeamProject}/_api/_build/ItemContent?buildUri=vstfs:///Build/Build/{BuildId}&path=/drop&__v=5 The only question left is where can I find the build ID in web access (or VS Team Explorer)? The queued builds list has an ID column, but the completed builds list does not
I figured out the build ID question - I updated my "Build number format" setting in the build process definition to use the $(BuildID) macro, and now it's extremely obvious

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.