Category: Team Foundation Server


Today one of my colleagues needed to move some files into a sub-folder in the project’s workspace in TFS 2008 Source Control.

It seems with Team Explorer, you can move individual files by right-clicking the file and choosing Move. However, you can’t do this with multiple files selected! You can move a whole folder, but that moves the entire folder and not just the files in it, so it doesn’t work to a sub-folder within that folder.

I suggested checking out the files, moving them in the workspace on his local machine and then checking them back in. I was thinking that TFS would be aware that these files have now moved and would handle this accordingly. WRONG!

We could move them and then add them as new files in the “new” location, but this would mean they lose all the history for the files.

It turns out, you can’t move files around in Source Control using Team Explorer, but you can by using the tf.exe command-line utility provided (usually found in: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE). You’ll need to add the correct path for your computer using the DOS Set command like this:

SET PATH=%PATH%;"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE"

To do this you use the rename function of the utility and provide the new location for the files, like this:

  1. Get the latest copy of the files that you want to move, using Team Explorer.
  2. Open a Command Prompt and change to the drive and path where the files you want to move currently exist.
  3. Move the files to the new location using the rename function of the tf.exe command-line utility like this:

 tf rename <files> <new_location> /lock:checkin 

The following example will move all files into a sub-folder of the current folder called Video Thumbs:

 tf rename *.* "Video Thumbs" /lock:checkin 

If you now look at the Source Control new & old folders in the workspace and you should see your files have been moved. All you have to do now is check in the changes and the files are moved!

WARNING: Using a wildcard like *.* will also move folders!

During my time working with Work Items in TFS2008 I have discovered these useful commands:

 witfields <action> /s:<server_name> <field_ref_name> 

Where <action> can be: view, delete, rename, report, rebuildcache

more information can be found on MSDN here

There are also two commands available when you install the October 2008 release of the TFS 2008 Power Tools. I haven’t used them but I will have a play and update this post with more information!

They are: DestroyWITD & DestroyWI which destroys Work Item Types and Work Items respectively (instead of just deleting them!)

more information on the Power Tools can be found here

I’ve recently been playing with redesigning Work Items in TFS2008, as the Administrator of TFS.

There are certain things you can’t do, such as have a fields value calculated based on the value of one or more other fields (at least not out of the box), but I have come up with a clever way to “get around” this.

I wanted an Importance field to be the value of Priority multiplied by Severity. This couldn’t be done out of the box, and writing custom controls etc., is a little beyond me at the moment. My “solution” was to have the Importance field show Allowed Values based on what Severity (although Priority could be used instead) was set to. So if Severity was set to 3 then Importance could only be multiples of 3 up to 15.

tfs-importance

I also made it that if either Priority or Severity was changed, then Importance would be set back to an empty field. I had to use the Copy rule to set it to an empty value as using Empty, emptied the field but didn’t initially allow you to select a new valid value.

With Importance also being a Required field, when it is cleared, the user has to set a new value! I agree its not perfect, but it kind of works!!

At my current employer, I am the sole administrator for Microsoft’s Team Foundation Server 2008.

When I first started here, I took over TFS Admin, but the server was configured very strangely. So as I was required to ‘prove’ a backup/restore solution for their TFS data, it was agreed that I would also perform a new build of the TFS server.

When I first took over the admin role, there were some permission issues. I wasn’t able to create new projects. I eventually sorted this and created a ‘TEST’ project.

Having restored the existing project data to my newly built server, I wanted to remove this TEST project. From Visual Studio 2008/Team Explorer 2008 it isn’t obvious how you delete a team project from TFS.

Searching the Internet revealed it was possible using the command-line command TfsDeleteProject

Here’s an example:

TfsDeleteProject /server:<server_name> "<project_name>"

Where:
<server_name> is the name of your TFS Server
<project_name> is the name of the project to delete

Neil

Follow

Get every new post delivered to your Inbox.