I've seen quite a bit of angst from new TFS users over the "Get Latest Version" behavior in Team Foundation Server source code control, so I think it's worth a bit of discussion.

The most common issue people report is that issuing the "Get Latest Version" doesn't actually bring the latest version of the file down from the server when the local copy has been deleted for some reason (intentionally or otherwise). 

It may surprise you at first, but this is actually the intended behavior of TFS!  TFS stores information on the server about which versions you have "gotten" to your local workspace.  We do this to reduce the amount of files you have to copy down when you issue a "get latest" from the top level of your project as most people do.  This speeds up your "get" significantly by only refreshing the items in your workspace that have changed on the server.  Imagine if you had a large project and the server always sent you the latest version of every file even if you had it on your disk already.  You'd be sitting around twiddling your thumbs for a long time while you waited for the server to give you what you already have.  That's not productive, right?  ;)

Of course, there are ways to "fool" any system.  In this case, you can fool TFS either by marking a local file as writeable without actually checking it out or by deleting a local copy of a file without pending a "delete" command to TFS.  In both of these cases, the server has no idea that you've modified or deleted your local files.  If doing this on a regular basis is part of your normal workflow, I'd love to hear more details about why you do this.

So how do you really Get Latest?

From the UI (i.e. Solution Explorer or the Source Control Explorer)

1.  Right click on the item(s) you want to get and click Get Specific Version

2.  In the dialog that pops up, check the appropriate checkbox for your situation:

  • If you've marked a local copy writeable without actually checking it out, and if you don't care about losing any changes to the file, check "Overwrite writeable files that are not checked out"
  • If you've deleted a local copy and want to get it back, check "Overwrite all files even if the local version matches the specified version"

Get Specific Version dialog

If these still don't help, post comments here or post questions in the MSDN forums and we'll help you out.

Here are some other discussions of the Get Latest behavior: