A few months ago our Team Foundation Server (TFS) box failed and we lost some data. I thought our new TFS box was headed for the same end the other day when I pulled up a history list for a Visual Studio project and saw that there were not nearly as many entries in the history list as there should have been.

A few minutes and a few valiums later, I figured out why there were so few entries in the history list. It turns out there are two ways to get the TFS history from Visual Studio.

View History from Solution Explorer

The first way is to select the View History option from the context menu of a file in in the Visual Studio Solution Explorer (see screenshot below). This way of viewing TFS history only pulls up the history items for the specifically selected item (the selected project file in this case), and not a rolled-up history for its child items (the files within the project). The screenshot below and the right shows the history list for just the selected project.

 

 

View History from Source Control Explorer

The other way to view TFS from Visual Studio is to do so from an item’s context menu in the Source Control Explorer in Visual Studio. From the screenshot below and to the left, there is no visual distinction between the View History menu item in the Source Control Explorer and the one in the Solution Explorer. However, look at the change-sets returned by the View History menu item from the Source Control Explorer in the screenshot below and to the right. There are three change-sets that for the project that were not present in the history view returned by the Solution Explorer. These additional change-sets represent a rolled-up view of changes that were made to files within the project (code changes), but that did not include changes to the project file itself (like adding a file to or removing a file from the project). The history view from the Source Control Explorer shows a complete roll-up of all changes made to the selected item as well as child items.

 

Summary

The moral of this story is:

  • If you want to see TFS change history for just the selected item, use the View History command from the items context menu in the Visual Studio Solution Explorer.
  • If you want to see a rolled-up TFS change history for the item and any child items, use the use the View History command from the items context menu in the Visual Studio Source Control Explorer.