Wednesday, January 22, 2014

Neat TFS enhancements


http://gillesperon.blogspot.com/2011/10/tips-useful-commands-for-tfs-in-visual.html
This is nice example for more useful shorcuts -vietsoft

This post is a short remember of 2 TFS command lines I use a lot.
Because of that, I like to have them defined as "External Tools" in Visual Studio.

Command 1: Preview of a get latest

I like to know exactly what I will get before getting it [therefore I can know when a merge will be required before starting it... No need to have a bad surprise when it can be avoided!]

This first command is in fact the classic "get", with the option "/preview".
Which gives:
c:\program files (x86)\microsoft visual studio 10.0\Common7\IDE\TF.exe get /preview /recursive

Here how you can integrate it in Visual Studio.
Select "Tools" > "External Tools…", and then create a new entry:

Creation of the command "TFS Test Get"
Values should be:

  • A meaningful title ☺
  • Command:     c:\program files (x86)\microsoft visual studio 10.0\Common7\IDE\TF.exe
  • Arguments:     get /preview /recursive
  • Initial directory:     $(SolutionDir)
  • Select the option "Use Output window"

Observation: this command is interesting to know which files will be updated, and if some merges will be required, however I strongly advise any TFS user to use Team Foundation Sidekicks.


Command 2: Undo unchanged checked out files

In TFS a file must be checked out before being modified.
The "check out" operation can be automated (no prompt will appear), but very often some files are checked out without being modified... (because you did a modification but canceled it after, or because a whole group of files have been checked out at the same time, or those annoying "*.vspscc" files...)

This second command is available in the power tools and allows to cancel the check out of all the files that don't contain any modification.
Here is the command:
C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\TFPT.EXE uu /noget /recursive

Here again how you can integrate it in Visual Studio.
Select "Tools" > "External Tools…", and then create a new entry:

Creation of the command "TFS uu" ("uu" standing for "undo unchanged")
Values should be:


  • A meaningful title ☺
  • Command:     C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\TFPT.EXE
  • Arguments:     uu /noget /recursive
  • Initial directory:     $(SolutionDir)
  • Select the option "Use Output window"

Observations:
  • I always run this command before any commit or any shelve, therefore I know exactly what I will commit,
  • If you are in a situation in which some files have been modified in your workspace without having been checked out (meaning that TFS does not know there are some modifications), you can quickly find them by doing a recursive checked out of all the files, and then calling this command.

Last advice: Create some shortcuts

Because I am using those commands before each get latest and before each commit, I usually like to define some shortcuts to call them quickly.
Those commands are among a few ones I even put in the main menu bar.
To do so, you can do a right click on the main menu bar, and select "Customize…".

Add your external commands
Notice that you will not see the name of your commands in the "Customize" panel. You will see "External Command #". However the names will be ok (and you can even put some icons if you prefer).

That's it for those 2 basic but useful commands.
G

No comments:

Post a Comment