I would like to get the source code of a project at specific time (changeset). So I need do download whole folder. I would like to do it for different times and handling a different workspace is not very convenient.
I know about TFS Get Specific Version into separate folder (with workspace) and Need command to get a file from TFS without a workspace (one file).
Is there some solution for whole folder without creating a new workspace?
Edit I have found the accepted answer too ambitious. I needed something more simple.
Assumptions:
- I can access TFS from Visual Studio on my computer
- I want to get the
ChangeSetNumber
Changeset from the folderDesiredFolder
in TFS projecttProj
I run the following batch from a destination folder in Visual Studio Command Prompt
set workspace_name=TemporaryWorkspace%username%
set changeset= ChangeSetNumber
tf workspace -new %workspace_name% -noprompt
tf workfold -map $/tProj . -workspace:%workspace_name%
tf get $/tProj/DesiredFolder -version:C%changeset% -recursive -noprompt
tf workfold -unmap . -workspace:%workspace_name%
tf workspace -delete %workspace_name% -noprompt
It is necessary to confirm remove source control association when starting the downloaded solution.
Edit 2023 I wanted to use the script but I was getting the following error:
Unable to determine the workspace.
I managed to find a solution in SO:Unable to determine the workspace using TF.exe. And from it I have a corrected script:
set workspace_name=TemporaryWorkspace%username%
set changeset=ChangeSetNumber
tf workspace -new %workspace_name% -noprompt /collection:<team-project-collection-url>
tf workfold -map $/ . -workspace:%workspace_name%
tf get $/tProj/DesiredFolder -version:C%changeset% -recursive -noprompt
tf workfold -unmap . -workspace:%workspace_name%
tf workspace -delete %workspace_name% -noprompt
Where <team-project-collection-url>
is the URL of the project collection that contains the workspace that you want to create, for example, https://myserver:8080/tfs/DefaultCollection
.
Probably something has changed during past five or six versions of Visual Studio