Peet Brits
Peet Brits

Reputation: 3247

Why does TFS "Remove Mapping" delete my files?

I wanted to check out an older version of the project in a different folder because I did not want to disturb my modified local content, so I thought I would just remove the mapping and map it to another folder and later map it back.

I was shocked to see that it started deleting my files!!! I quickly clicked cancel. Luckily it appears that it did not delete my modified and local files.

How am I supposed to do a thing like this?

This happened with Visual Studio 2010's Team Foundation Server, but I am sure it applies to all versions.

Upvotes: 18

Views: 8084

Answers (2)

pantelif
pantelif

Reputation: 8544

A straightforward way to do what you 're after, without generating any new workspace, is to:

  • Shelve your pending changes into a new shelveset
  • Get the specific version you 're looking for & do any reviews
  • Get latest once you 're done
  • Unshelve your previously shelved changes

Upvotes: 6

daz-fuller
daz-fuller

Reputation: 1231

It does it because TFS is useless. You could however use the "TF.exe" command line to get around some of the limitations of the UI.

The TF.exe command should be under something like the following, so it's probably worth adding this directory to your path.

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\tf.exe

You can then choose a suitable location on your drive, create a new workspace and then get the code at a specific version (or just the latest)

C:\my_temp_location> tf.exe workspace /new <workspace_name> /collection:<server_location>
C:\my_temp_location> tf.exe get <source_location> /version:<changeset> /recursive

If you want to see a list of workspaces you currently have then you can just run the following command:

C:\> tf.exe workspaces

Upvotes: 11

Related Questions