Tips ‘N’ Tricks – TFS – Always Check-Out the Latest Version of Code from TFS

I had previously written a tip on Right way to get the latest code from TFS. Well, that’s when you want to get the latest for viewing/reviewing purposes etc. However, when multiple developers are working on the same set of files, it is important that all the dependencies are taken care properly and before making any changes on the server, it is essential that we get a latest version of code from TFS to our local workspace, Check-Out the code and then we can make changes and Check-In the code.
Now, you might ask, why should I always manually Get the Latest Version of code and then Check-Out? When we are saying that it is best practice and in fact a mandatory step especially when working in a team, shouldn’t there be an option which by default checks out the latest version of code? Yes you are right! There indeed is an option in Visual Studio/Team Foundation Server to do that. Simply follow the below steps to know how to go about doing it.
  • Open Visual Studio 2010
  • Connect to your Team Project on Team Foundation Server
  • Go to Tools | Options…
  • Go to Source Control in the left navigation pane and expand it
  • From the expanded menu, select Visual Studio Team Foundation Server
  • Now select the check box Get latest version of item on check out as shown below
  • Click on OK and you are done

Get Latest Version of item on check out

Now, you don’t need to manually get the latest version of code from Team Foundation Server into your Local Workspace before Checking-Out. The above option will take care of Getting the Latest Version before performing the Check-Out. All you need to do is, just go and Check-Out the code which you need and rest will be taken care by the above setting.

Similar settings can be made at the Team Project level so that it is set as a default option for all the users connecting to the Team Project. For more information, visit this msdn article.
Note: This demonstration is based on Visual Studio 2010 Team Foundation Server (TFS)

About Dattatrey Sindol (Datta)

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

Posted on June 15, 2012, in Best Practices, Shortcuts, TFS, TFS Tips, Tips 'N' Tricks, Visual Studio, Visual Studio Tips and tagged , , , , , , , . Bookmark the permalink. 1 Comment.

What are your thoughts?

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: