Often I hear the following questions about TFS version control:
- Can I just download files or folders from TFS without having to create a workspace?
- Can I specify that files do not have the read-only attribute set?
- Can I configure that files show the last check-in time as last write time?
- Can can I “export” files from TFS and remove the bindings to my TFS?
The answer is: Yes, you can!
Using tfsexport.exe:
A few notes on what the tool offers:
- Files/Folders are downloaded from TFS without requiring a workspace.
- There is no read-only flag set on the files exported.
- Optionally sets the file time to the time of last check-in.
- Optionally removes the source control bindings (from VS solution/project files).
Download the tool from here:
- For Team Explorer 2010: TfsExport.exe (.ZIP, 5,58 KB)
- For Team Explorer 2012: TfsExport.exe (.ZIP, 5,60 KB)
- For Team Explorer 2013: TfsExport.exe (.ZIP, 13,01 KB)
- Prerequisite: For the versions above, this tool requires VS or Team Explorer to be installed.
- For TFS 2015/2017: TfsToolsSuite.zip (.ZIP, standalone)
(Special thanks to Grant Holliday and Marcel de Vries)
–Neno
If you just want to download a file without a workspace, you can also use: tf view /collection:http://server:8080/tfs/Collection1 $/folder/path/file.cs /outputfile:file.cs
However, it won’t set the file time to the checked-in time, or remove source control bindings, like Neno’s tool does.
Right. I should make it more clear that the tool can actually export a whole folder at once (with removing bindings etc.)
Awesome tool!!
I’ll add example of usage:
set folder=Demo
tfsexport.exe /serverpath:$/%folder% /localpath:D:\_tfs_backup\%folder% /collection:https://Yourname.visualstudio.com/defaultcollection /settimestamps /removebindings
Thanks, Rockie! 🙂
–Neno
I’m not sure what to use for the /serverpath parameter. We no longer use TFS, but we still have a couple things stored there that I need to export.
You need to specify a folder (like $/SomeProject). To download everything, try /serverpath:$/
–Neno
And to make party complete! :))
PS script that backups all projects in TFS collection:
# todo: add here Your projects names
$myProjects = @(“TfsProject1″
,”TfsProject1″
,”TfsProject3”
)
foreach($folder in $myArray)
{
write-host($folder)
$args1 = “/serverpath:$/{0} /localpath:D:\_prj_tfs_backup\{1} /collection:https://YourName.visualstudio.com/defaultcollection /settimestamps /removebindings” -f $folder, $folder
start “C:\TfsToolsSuite\TfsExport.exe” $args1
}
p.s.: Cooooool toool)
Thanks, Rockie! 🙂
–Neno
Hi I am working in linux platform. I am using Team Foundation Explorer Everywhere Cross Platform Tool. I have to create workspace to download the code. can you help me on how to use this tool in linux
Paramesh,
TfsExport.exe only supports Windows.
–Neno