Tips ‘N’ Tricks – TFS – Getting Latest Code from TFS, The Right Way!

Sometimes when we try to get the latest code from TFS using Get Latest Version option, it does not get us the latest changes in various scenarios. Example: When some of the files are removed/missing from local folder (workspace) etc.
 
The issue can be reproduced using the following steps:
  • Connect to your Team Project on Source Control/Team Foundation Server.
  • Create a new workspace by mapping to appropriate folder on local file system.
  • Download the latest code from TFS into local using Get Latest Version option.
  • Now, go to file system (workspace) and delete few of the files which you just downloaded in previous step.
  • Go back to TFS and try to get the latest version of the code using Get Latest Version option for the same folder/workspace for which you downloaded the latest code in previous steps. Now you will see the following dialog box which says all your local files are up to date.

Note that you deleted few files from your local folder but still Get Latest Version option says all the local files are up to date.
 
To address this issue and to get the latest code from TFS, here is the correct approach. Follow the below mentioned steps to Get the Latest Code from TFS in the Right Way!
  • Connect to your Team Project on Source Control/Team Foundation Server.
  • Right click on the folder for which you want to download the latest server changes to local and select Get Specific Version… option from the context menu.
  • Now a dialog box appears as shown below:

The above dialog box is self-explanatory with the items highlighted and the callouts.

The settings in the above dialog box will get the latest version of the code from TFS into your local environment (workspace) by overwriting any modified/unmodified files (locally in file system) and leaving any checked out files untouched/unmodified.
 
Note: This demonstration is based on Team Foundation Server 2010 (Visual Studio 2010 Ultimate).
 
Advertisements

About Dattatrey Sindol (Datta)

Datta is a Microsoft BI Enthusiast, passionate developer, and a blogger. View Full Profile

Posted on May 22, 2012, in TFS, TFS Tips, Tips 'N' Tricks and tagged , , , , . Bookmark the permalink. 5 Comments.

  1. still i have done the get specific version, and no luck — still does not work, i am getting the prompt shown in the first figure, but no files are actually on the local machine

  2. “Overwrite all files…” will touch all files setting their date+time to the current time. So you’ll have to recompile all files when you do this.

  3. Is there any way to just say override the local file if the extension is of a particular type?

  1. Pingback: Tips ‘N’ Tricks – Tips, Tricks, Techniques, and Shortcuts to Improve Productivity, and Design and Coding Skills « Datta's Ramblings on Business Intelligence 'N' Life

  2. Pingback: Tips ‘N’ Tricks – TFS – Always Check-Out the Latest Version of Code from TFS « Datta's Ramblings on Business Intelligence 'N' Life

What are your thoughts?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: