Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Perform a TFS get to a supplied or current directory path, ignoring workspace settings

Tags:

tfs

I am using TFS 2010 and writing a script to enable a simple get of specific version label of our software. Since this is only a simple get, is there anyway to just perform a get without having to use the current workspace settings or change the workspace settings to the desired path? There is no reason to link the files to CM after the get, so I have no reason to preserve this 'workspace'. I just want to be able to create a directory anywhere I want and get TFS to give me a copy of the current version labeled files at the current directory, or to a directory I supply 'on the fly'. There seems to be no way to seperate a simple get from the project workspace settings. Am I missing something or am I forced to cloak or change workspace settings before the get?

like image 901
Dean Roberson Avatar asked May 16 '12 17:05

Dean Roberson


2 Answers

You'll need a workspace to do a get, but it need not be the same workspace that you're using for Visual Studio. In fact, you can just create a simple throwaway workspace, for example:

# {{Server}} is http://server:8080/tfs/DefaultCollection; for readability.

tf workspace /new temp_workspace /collection:{{server}} /noprompt
tf workfold /map $/Project/Project C:\Build\Project
tf get C:\Build\Project /recursive /noprompt
tf workspace /delete temp_workspace /collection:http{{server}} /noprompt

Note that the TFS SDK does provide mechanisms to do a download of an Item without needing to create a workspace, so you could write a program to do this, but it would be a fair amount of code to avoid creating a workspace which is, ultimately, a fairly inexpensive operation.

like image 50
Edward Thomson Avatar answered Sep 21 '22 21:09

Edward Thomson


Neno Loje created a small utility that offers this functionality in one command from the commandline.

like image 39
jessehouwing Avatar answered Sep 21 '22 21:09

jessehouwing