DEV Community

Cover image for Sparky's Tool Tips: TFS Auto Shelve
Brian Schroer
Brian Schroer

Posted on • Edited on

Sparky's Tool Tips: TFS Auto Shelve

This may be the most useful tool I've blogged about, and probably the simplest...

TFS Auto Shelve for Visual Studio is a Visual Studio 2019 extension that periodically shelves pending changes to Team Foundation System or Azure DevOps source control.

I can't count how many times I've used it to retrieve code files I've accidentally deleted, or files where I've started making changes and saved my mind and wanted to "roll back" to a previous version that hadn't been checked in.

You use the Visual Studio "Tools | Options | TFS Auto Shelve" menu to configure how often you want to shelve, how many shelvesets to keep, and how they should be named.
TFS Auto Shelve Options

The name is defined using placeholders, and the default name is "Auto-{0}":

  • {0}: WorkspaceInfo.Name (machine name for me - I'm not sure if it's something different for other installations)
  • {1}: WorkspaceInfo.OwnerName
  • {2}: DateTime.Now
  • {3}: Domain of WorkspaceInfo.OwnerName
  • {4}: UserName of WorkspaceInfo.OwnerName

You can retrieve shelved files via the Visual Studio "File | Source Control | Find | Find Shelvesets" menu:

"Find Shelvesets" window, showing shelvesets saved by TFS Auto Shelve

(I've used my incredible graphic skills😉 on the screenshot to block out information specific to the company where I work.)

You can see from the screenshot above that there were no shelvesets created overnight or over the weekend. Iit's smart enough to only create them while you're actively using Visual Studio.

The extension adds two items to the Visual Studio "Team" menu. The first shows you whether the extension is running, and the second lets you create an on-demand shelveset:

Teams / TFS Auto Shelve Visual Studio menu

Top comments (0)