Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How best to download source files from VSTS?

I need to regularly download a complete set of latest code for a particular project from a VSTS account (server workspace), to a folder on a file server for readonly archiving.

Currently I log on to the web portal and click Download as ZIP for the selected project and save this to the file server.

But I'd like a more automated way, preferably something I can schedule to run from the file server itself which won't have Visual Studio installed or cached credentials for the online account.

Any of the following soluions would be ok:

  • A permanent URL to download the latest code as a zip file
  • A REST URL to get all latest files
  • A command line tool to connect to the VSTS account and download all latest files for a particular project to a specified local folder, not the default local folder

Nice to have:

  • Option to download as ZIP or recursive folder of files
  • Set files modified date as check-in time
  • Remove source control binding information from the downloaded files
  • Provide user credentials as part of the command line, not assume to use the default cached credentials on the machine
like image 413
userSteve Avatar asked Oct 16 '22 17:10

userSteve


1 Answers

You could use our tools in Visual Studio, Eclipse, or from the command line to keep a local copy of your source code on your machine.

More details please refer official tutorial: Download (get) files from the Server

Also, if you want to download your code as a zip:

You can click on any ellipsis to find the menu which contains Download as Zip option.

enter image description here

If you want a automated way, suggest you use the build pipeline. You could disable the default get source steps in the build definition. And use your own powershell script to do the get source/pull files to the workspace. How to, please follow: Is it able to ignore/disable the first step Get source in vNext Build?

This will download files in your build agent, if it's not the machine you are working on. You could combine Archive Files & Windows Machine File Copy task and select Scheduled trigger in your build definition.

like image 104
PatrickLu-MSFT Avatar answered Oct 20 '22 17:10

PatrickLu-MSFT