Tag Archive: Tips & Tricks


So a teammate of mine changed jobs recently, and left a little bit of mess behind on TFS (our team uses TFS Preview). Pending changes including adding package items with exclusive lock. As I’ve been looking for an information on how to drop his pending changes, it turned out quite easy to perform for existing files (change type: edit, lock), yet not for all new files (change type: add, lock).

Here’s a bunch of commands you can run on your local dev machine from the Visual Studio Command Prompt. You need to have admin rights on TFS for the project in order to do something more than listing.

LIST WORKSPACES OWNED BY user@domain.com

tf workspaces /owner:user@domain.com
              /collection:https://yourproject.tfspreview.com/defaultcollection

LIST ALL PENDING CHANGES IN WORKSPACENAME;user@domain.com

tf status $/PROJECTNAME/* /workspace:WORKSPACENAME;user@domain.com
          /collection:https://yourproject.tfspreview.com/defaultcollection
          /recursive

UNDO ALL PEDING CHANGES IN WORKSPACENAME;user@domain.com

tf undo $/PROJECTNAME/* /workspace:WORKSPACENAME;user@domain.com
        /collection:https://yourproject.tfspreview.com/defaultcollection
        /recursive

References

Advertisements

Having guidelines in your code editor makes it a bit easier to maintain your code in a tidy manner. For Visual Studio 2010, I use these free extensions:

  • Indent Guides by Steve Dower – displays indent guides in Visual Studio text editor windows.
  • Editor Guidelines by Paul Harrington – adds vertical guidelines behind the text at user-specified column positions.
  • Editor Guidelines UI by Paul Harrington – adds submenu with three commands to the code editor’s context menu (right click) for managing editor guidelines – no need to edit the registry for guidelines configuration anymore.

For Visual Studio 2008 and older, you have to use regedit. Navigate to:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor

and add a string named Guides with value RGB(0,255,0),80 to create a guideline after column 80. To get more guidelines e.g., after column 80 and 130, set the value to RGB(0,255,0),80,130.

Note: Editor Guidelines extension for VS2010 uses a registry entry similar to the one described above, however its syntax is less strict. I found out on VS2008, that “Guides” string value cannot contain any spaces.

Registry paths for various Visual Studio versions:

2003: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\Text Editor
2005: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor
2008: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor
2008 Express: HKEY_CURRENT_USER\Software\Microsoft\VCExpress\9.0\Text Editor

References