16 July 2007

Refreshing TFS Version Control Status Icons

I've seen a some posts lately related to the version control status icons that are displayed in the Solution Explorer within Visual Studio 2005 Team System.  The problem with these status icons is that they do not automatically update to reflect the current status when a file is checked out or back in.  Even refreshing the Solution Explorer does not refresh the status icons.  To see this in action, open a solution in Visual Studio and have someone else check one of the solution files out.  Refresh your Solution Explorer by right-clicking on a project and selecting Refresh.

There is a way to refresh the status icons - by clicking on File-->Source Control-->Refresh Status.  This will update the status icons to reflect whether a file is checked in or out.  If you're like me and prefer to use the keyboard when possible, you can easily assign a hotkey to this command by:

  1. Click on the Tools-->Options menu item within Visual Studio.
  2. Click on the Environment-->Keyboard node.
  3. Enter "tfsrefreshstatus" into the Show commands containing textbox.
  4. Select the entry "File.TfsRefreshStatus".  This is the command that is executed when you click on File-->Source Control-->Refresh Status.
  5. Enter a shortcut by clicking in the Press shortcut keys textbox and pressing Ctrl+R, Ctrl+S (or any other command sequence you wish) and click on the Assign button.  See the screen shot below for an example:

Visual Studio Options

Although I'd rather see the status icons update automatically, this is an easy workaround.