TFS Interview Questions And Answers

TFS (Team Foundation Server) is widely used in software development, particularly in organizations that follow the Microsoft development stack. This means that there is a consistent demand for professionals with TFS expertise. If you are considering a career in TFS, here are the set of frequently asked TFS interview questions to get you familiar with the interviews' topics. Have a look and grab the dream job!

Mindmajix as a team has got enough questions from the trainees who got their TFS Training and cracked interviews at various MNCs around the world and successfully placed. From the collection of TFS Interview questions, the following are the most common questions we got are listed to make it easy for those who are willing to crack the interview with ease. All the answers to those were written by our professional experienced trainers and are tailored to meet the concepts expected by the interviewer.

If you would like to Enrich your career and get certified professional, then visit Mindmajix - A Global online training platform: “TFS Certification”  Course.  This course will help you to achieve excellence in this domain.

TFS Interview Questions

1. Define TFS?

2. What are the features given by TFS?

3. Setting up Team foundation server

4. Is there a way to link work items across projects in TFS

5. How can I see all items checked out by other users in TFS?

6. TFS: Moving from one server to another, How do I move my code and change history from one TFS server to another?

7. What to do with a branch after the merge with TFS

8. How do I find and view a TFS changeset by comment text?

9. TFS: Create a new project from an existing one in TFS

10. How can I exclude specific files from the TFS source control?

TFS Interview Questions and Answers for Experienced

Q1. Define TFS?

Ans: TFS means Team foundation server that used for inter-communication among the testing team, developer team, PM (Project Manager), and the CEO for a software development environment.

Q2. What are the features given by TFS?


  • Version Control
  • Tracking work items
  • Functions in Project Management
  • Team Build Automation
  • Data Collection & Reporting
  • Team Project Portal
  • Team Foundation Shared Services

Q3. Setting up Team foundation server


  • I have to set up a team foundation server for a company, something that I don’t have any experience in.
  • The company will have about 5 or so developers that will be using it.
  • Is this a big task or something that is fairly easy to do (with instructions)?
  • Any helpful tutorials that you can recommend?
  • Any recommendations on server specs for a team of 5-10?

Disregard the “Cliff’s Note” link – it’s for VSTS 2005. There’s no reason to install an old version – the installer (and everything else about the product) is MUCH improved with VSTS2008. Also make sure you install SP1 – it’s not just bug fixes but some MAJOR enhancements.
Instructions for install are here: TEAM FOUNDATION VSTS2008 INSTALL GUIDE make sure you closely follow the recommendations for the Accounts necessary for install.
Blog post with recommendations for SERVER SPECS
The link that Espo posted is excellent walkthroughs for configuring TFS after you get it installed.


Also you will want the following

TFS 2008 POWER TOOLS in particular there is a “Team Foundation Server Best Practices Analyzer” which you can run against the server before the install to make sure everything is patched correctly etc (and afterwards to make sure the install went properly). It will require Windows Powershell installed on the server as pre-req.
Also you will want TEAM SYSTEM WEB ACCESS 2008 SP1 – (formerly Team Plain) which will allow you to access the features of TFS as a web application.

Q4. Is there a way to link work items across projects in TFS

Ans: In Team Foundation Server is there a way to have work items in one project linked to other projects so they show up in the reports in both. We are thinking about keeping release engineering items in their own project and want them linked to the project they are actually for as well. Is this possible? So, for instance, I would create the item under release engineering assign it to an engineer and then link it to Product X so it showed up as a work item for Project X as well.

This is possible in TFS 2010 at least: LINK TFS WORK ITEM TO DIFFERENT PROJECT
Not sure on the effects on reporting though.

Q5. How can I see all items checked out by other users in TFS?

Ans: I want a list of all the checked out files, by all users, in a project in TFS 2005. All I can see now are my checked out files – in the pending changes window. I remember that in Source Safe there was such an option is there one in TFS 2005?

The OCTOBER 2008 EDITION OF THE TFS POWER TOOLS includes “Team Members” functionality that allows you to do this and more.

There is more information on this feature on BRIAN HARRY’S BLOG.

tf status itemspec /user:* /recursive in the VS Command Prompt. itemspec is the TFS path to the item you want to search for checkouts. No extra installations needed

 MindMajix YouTube Channel

Q6. TFS: Moving from one server to another, How do I move my code and change history from one TFS server to another?

Ans: Use this: TFS TO TFS MIGRATION TOOL from CodePlex

Q7. What to do with a branch after the merge with TFS


  • After merging a branch back to the “trunk” what do most people do with the branch. Just delete it? Move it to another area? Change its permissions?
  • The concern we have is that developers who are away, and don’t read their mail could come to work and continue working on the branch, after the merge has been done.

Once the branch is definitely dead then I like to delete them. You can always undelete something in TFS if necessary (Options, Source Control, Show Deleted Items). Dev’s working in that area without realizing it may get some strange behaviour (i.e. files disappearing when they do a Get Latest) however it gets them to figure out something has happened pretty quickly.

That said, sometimes it can take a while to ensure that the branch is definitely deceased in which case changing the permissions on the branch so that only a limited number of people can edit the files on that branch is a handy technique. You can have one person lock all the files in the branch with a check-out lock but I’ve not found that to work too well when freezing a branch – permissions seems to work better so that you do not have to have a bunch of pending changes (the locks) to manage for all the files in the branch and also you can have more than one person working on it while it is being frozen.

Q8. How do I find and view a TFS changeset by comment text?

Ans: With TFS I need to find a changeset by the comment, or by the developer. Maybe I’m just blind today, but I don’t see a simple way in the Sorce Control Explorer to do this task?

With the Power Tools installed:

tf history $/ -r | ? { $_.comment -like *findme* }

EASY WAY and no 3rd party apps/add-ons needed:
Open Source Control Explorer
“View History” from the root of the TFS server
Scroll to the bottom (it’s fast with hitting the “End” button continuously)
Select all records, copy
Open Excel and paste
Now the Excel will allow you to search through comments (Excel’s a native app, don’t argue..).

Q9. TFS: Create a new project from an existing one in TFS

Ans: What is the best way to create a completely new project in TFS by copying an existing one?

I have an ASP.NET project that will have 50+ “releases” per year. Each release is a distinct entity that needs to remain independent of all others. Once created, I want to make sure that any change to one (the source project or the copy) does not affect the other.

This is for source control only. I do not need to copy any work items.

In the pre-TFS world, I would do this by simply copying the folder that contained all of the project files. This had me 90% of the way to the new app, which I could then tailor for the new release. It is very rare that I need to actually add functionality to the base application, and even when I do it never affects existing apps. Is this still possible to use TFS, by copying my local folders and then adding the copy into TFS as a new project?

Any suggestions? One branch per release looks like the “standard” way of doing this but I will quickly end up with dozens of branches that really aren’t related, and I’d rather keep each new project as it’s own distinct project, with no chance of changes in one affecting the other.
Thanks for the responses. I think you’ve all given me enough insight to get started. Richard, thanks for the detail. I was a bit concerned that it might be too easy to accidentally merge the branches.

I would recommend using branching. Create a branch for each release from the main branch. As long as you do not merge the branches they will remain independent. Changes to the main branch will only affect releases created after those changes were made.
You could copy the files and create a new project, but you may run into a couple of problems:
1. The projects “remember” that they were in TFS, there is a bit of manual work to clean up special files, etc.
2. TFS may slow down when you have many projects, compared with a single project with branches

Q10. How can I exclude specific files from the TFS source control?

Ans: We have multiple config files (app.DEV.config, app.TEST.config, etc) and a pre-build event that copies the correct config file to app.config. Obviously, the configuration specific files are in source control — but at the moment so is App.Config and that shouldn’t be.

How can I mark that one file as excluded from source control, but obviously not from the project?
I’m using VS 2005, and 2005 Team Explorer.

There is a check-in policy in the MS Power Tools which lets you screen filenames against a regular expression. See: MICROSOFT FOUNDATION SERVER POWER TOOLS While check-in policies are not completely foolproof, they are the closest thing TFS has to enforce user-defined rules like what you’re looking for.

If you just want to exclude a single file from Source Control, then select it in the Solution Explorer and choose “Exclude from Source Control” from the File>Source Control menu.

(And as the others have said, you can also cloak a file or folder, which means it stays in Source Control and is visible to everyone else on the team, but it’s not copied to your PC until you decide to uncloak it; or you can delete the file, which means it gets deleted from everybody’s PCs when they get latest – but neither of these options will prevent such files being added to source control in the first place)

It’s easy in TFS2012, create a .tfignore file

Add Files to the Server

Skip code block

# Ignore .cpp files in the ProjA sub-folder and all its subfolders
# Ignore .txt files in this folder
# Ignore .xml files in this folder and all its sub-folders
# Ignore all files in the Temp sub-folder
# Do not ignore .dll files in this folder nor in any of its sub-folders

[Do you know -->TFS Vs Jira]

Q11. TFS Work Item Query against TFS Groups

Ans: Does anybody know how to create a work item query in TFS that will query users against a TFS group? (ie, AssignedTo = [project]Contributors)

In visual studio 2008, there is an ‘In Group’ operator in the query editor. You can use it and specify any TFS group.

If that doesn’t work, try this. This is a fairly convoluted way to get the query working, but will work, involves using the group security identifier (SID) to bound the query.

SELECT [System.Id], [System.Title]

FROM WorkItems

WHERE [System.TeamProject] = @project
AND [System.AssignedTo] IN GROUP



ORDER BY [System.Id]

To find the SID of the specific group you're interested in, run the tfssecurity.exe utility as Run as Administrator with the /I Contributors and server parameter //server:MyTFSServer. This will return something like the following.

Resolving identity “Contributors”…
SID: S-1-9-1551374245-1204400969-2402986413-2179408616-1-3207752628-1878591311-2685660887- 2074056714

Identity type: Team Foundation Server application group Group type: Contributors Project scope: Server scope Display name: Contributors Description: Members of this application group can perform all privileged operations on the server.

It's long-winded, but once you know the SID, and build the WIQ query, and save it, that will be it.

Q12. Edit other users’ alerts for a project in TFS

Ans: I am unexpectedly taking over for the previous administrator of our TFS system who left the company rather abruptly. I was made an admin of TFS and on the TFS application server before this happened, but there is still at least one thing I can’t figure out. It seems there are some alerts set up under the previous administrator’s account that sends an email to all of us whenever a file is checked in. I can’t say for sure exactly what this subscription looks like, but I’m guessing it’s either in the “Project Alerts” dialogue for the project, or it’s an alert set up with TFS Power Tools’ Alert Editor. I can’t see alerts set up by other users in these areas. Is there any way short of directly editing the tbl_subscription table directly to try removing or changing these alerts? (I think I see the alert in that SQL table, but I don’t want to directly hack the database.)

I’m really glad to say that in the next version of TFS and in the current version of the Azure-hosted version of TFS, administrators can manage other user’s alerts using Team Web Access. Thankfully, this should be a scenario of frustration in the past.
I have some more information available on a blog post written for this topic here:

Creating E-Mail Alerts for Team Members in TFS

control panel

Q13. TFS Get Specific Version into a separate folder

Ans: I’m currently working on a project with TFS source control. We’ve just gotten in a bug report for an older version of the code, and I need to pull down that version of code to test it out. My first thought would be to “Get Specific Version” to pull down the code, but I’d rather not get that version into my current workspace directory.

Is there an easy way to “Get Specific Version” into a separate (e.g. temporary/throw-away folder), so I can quickly look into this bug in the older version of code, and not disturb my current work?

I just found one easy way to do this: Create a new Workspace in TFS pointing to a separate folder, then switch over to this new workspace and do a Get Specific Version here.

Q14. How to browse and view files stored in a Team Foundation Server without using Visual Studio

Ans: I’m looking for a tool to browse and view files stored within a Team Foundation Server without using Visual Studio. As I’m doing most development on a virtual machine, it’s very annoying to wake it up only to have a look at a certain file.

So is there a way to browse a TFS without Visual Studio?

The TFS Power Tools now have Windows Shell Extensions, so you manipulate source control files using only Windows Explorer. Your solution could be to just keep a working copy of the solution and then you do whatever manipulations you need to use Windows Explorer.

Microsoft Download Center

Q15. How to find all changes below a certain point in the TFS source control tree

Ans: I need to know what changes (if any) have happened at a particular level in our source control tree. Is there some way to make such a query of TFS?

Using Team Explorer:

  • Open Source Control Explorer
  • Navigate to desired source control folder
  • Right-click and choose View History
  • Shows you all of the changesets that have been checked in at that level in the tree or below.

Using the tf utility:

tf history c:localFolder -r -format:detailed

Here’s a link to the tf history documentation for more details on usage: LINK

Using the TFS SDK to do it programmatically:

Here’s a sample method based on some of our code. It takes a path, start time and end time and gives you all of the changeset details below that path in between the two specified times:
Skip code block

private StringBuilder GetTfsModifications(string tfsPath, DateTime startTime, DateTime endTime)
StringBuilder bodyContent = new StringBuilder();
TeamFoundationServer tfs = new TeamFoundationServer(“YourServerNameHere”);
VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
// Get collection of changesets below the given path
System.Collections.IEnumerable changesets = vcs.QueryHistory(
new DateVersionSpec(startTime),
new DateVersionSpec(endTime),
// Iterate through changesets and extract any data you want from them
foreach (Changeset changeset in changesets)
StringBuilder changes = new StringBuilder();
StringBuilder assocWorkItems = new StringBuilder();
// Create a list of the associated work items for the ChangeSet
foreach (WorkItem assocWorkItem in changeset.WorkItems)
// Get details from each of the changes in the changeset
foreach (Change change in changeset.Changes)
changes.AppendLine(string.Format(CultureInfo.InvariantCulture, “t{0}t{1}”,
// Get some details from the changeset and append the individual change details below it
if (changes.Length > 0)
bodyContent.AppendLine(string.Format(CultureInfo.InvariantCulture, “{0}t{1}t{2}t{3}t{4}”,
changeset.Committer.Substring(changeset.Committer.IndexOf(‘’) + 1),
return bodyContent;

Q16. Unified Diff in TFS

Ans: Anyone knows if this (generating a unified diff) is possible and if so, how?

This is what I usually do:

Generate a unified diff from tf command line to get a patch file

tf diff /recursive /format:unified .  >> diff.patch

Apply patch with

patch.exe -p0 < diff.patch

Obviously, this assumes that the source files are already checked out. If they are not, especially when you are applying patches across branches, write a simple shell script to go through the diff file, get the path of the file, and edit them.

Q17. TFS: Overwrite a branch with another

Ans: Is it possible to overwrite a branch with another?
Or is the only solution to delete branch B and make a new branch from Branch A?

Unless you’re running TFS 2010, I’d recommend using Merge + Resolve to bring the two branches back in sync.
tf merge A B -r -force -version:1~T
tf resolve B -r -auto:acceptTheirs
That should equalize everything, except for files that were only created in B and never merged back. Use Folder Diff to find & reconcile them.
Delete + rebranch in 2005/2008 runs the risk of nightmarish-to-debug namespace conflicts in the future. The other option, if you have 2008, is to Destroy + rebranch. Obviously, that assumes you are ok with losing all the history from the original copy of B.

Q18. How to browse TFS changesets?


  • I want to browse TFS changesets.
  • I do NOT want to search changesets by specifying a file contained within the changeset. I do not want to specify which user I think created the changeset.
  • I simply want to key in a changeset number and look at that changeset. Or maybe view a range, and then browse those.
  • No specified file, no specified user. TFS 2008 seems to not want to allow me to do this.
  • I must be missing something.
  • How do you do this?

In Source Control Explorer, hit CTRL+G. This will bring up the Find Changesets dialogue. Unfortunately, it’s kind of one-size-fits-all in VS 2008: you have to work inside a big bulky search dialogue, even if you already know the number(s). In your case, flip the radio button to search by the range and then key in the desired changeset number as both the start & end of the range.
The VS 2010 version of this dialogue simplifies the “lookup single changeset by #” use case, FWIW.
My personal preference: if you have a console window open, there’s a quicker route. Simply type tf changeset 12345. If using the Power Tools, you can substitute “Get-TfsChangeset” or “tfchangeset” for improved performance and programmability.

Q19. Team Foundation Server How to Edit file without checking it out

Ans: I’m working with TFS and I need to edit the file locally without checking it out. another case if some one checked in the file and i need to change my local copy.
what should I do ? in Visual source safe, we can do that by removing the read only check on the file.

A: Ok, this is relatively easy in VS2010, and quite normal. I mean the locking model of source control is obsolete anyway.
In vs2010, click Tools -> Options -> Source Control -> Environment and select Allow checked-in items to be edited. This should stop the TF client from marking files as read-only.
Also, you may have to change the Editing drop-down in to Source Control -> Environment Do nothing.

Q20. How do I remove files from the Pending Changes list in TFS when those files have been deleted locally

Ans: as the question says…anyone now how I can remove these files. I didn’t commit the changes in TFS before I deleted them locally and now they always appear in the Pending Changes window…I’d like to get rid of them
Right-click on the file in the Pending Changes list, choose Undo.
>> Brian
>> Solved
I recreated the deleted folder directory and files in TFS and checked them in. Then I deleted them and they were gone from the Pending changes window.

Q21. How to add an image to a TFS work item; as an image, not as an attachment

Ans: Our team is in the process of beginning a project which is being managed using TFS. Several requirements

that existed only in Word documents are being migrated to TFS work items. The Word documents contain various diagrams and images which we need to be included in the work item, specifically under the ‘Details’ and ‘Analysis’ tabs. The problem is that images cannot be pasted into these tabs as images.
The only option to add images to the work item appears to be as an attachment.
Could someone confirm this?
Any assistance is appreciated.

You can change the text boxes to accept HTML, but that may still require the image to be hosted elsewhere.

How to do Rich HTML descriptions instead of plain text

It may also be best to just link to the existing document. We have to do this for now, because we have a large repository of existing documentation that no-one wants to bother converting.

Q22. How to unlock a file from someone else in Team Foundation Server

Ans: We have a project that is stored within our TFS server and some files were Checked-Out by me from another computer and another user (both of which are not used anymore). Is there a way to force the unlocking of the file (no changes were made to it so it’s safe to do so if I can only do it).

You can use the Status Sidekick of the TFS Sidekicks tool and unlock the files which are checked out by other users. To do this you should be a part of the Administrator group of that particular Team Project (or) your group should have the permissions to undo and unlock the other user changes which by default Administrator group has.

Q23. How can I get all my check-ins in Visual Studio 2010 TFS?

Ans: Many occasions I need to review my checkins . Is there a way I can get all my checkins in TFS? I don't mean view history on a particular file, but all my checkins! If I can filter based on the start and end date would be great

  • Open “Team Explorer” (Found in “View”-menu)
  • Find the team-project and expand “Team Members”
  • Right-click the team member and select “Show Checkin History”.
  • But it is very strange that one cannot do this filtering directly when viewing the entire history of a team-project.
  • Yet another alternative is to use the “Link to”-search within TFS WorkItem:
  • Open a TFS Workitem
  • Choose the “All Links”-tab
  • Press the “Link To”-button
  • In the new dialogue set “Link Type” to “Changeset” and press “Browse…”-button.
  • Now you have a TFS search dialogue, where one can specify a username and another filtering

Q24. What permissions are needed to add/edit work items in TFS

Ans: I would like to grant my Q/A team permissions to create an edit bugs in TFS. I could just throw them into the Contributors group, but I would rather create a Q/A group and assign it permissions specific to creating work items. What permissions do I need to grant them. (TFS 2008)
It’s actually going to be found under Area security. Within VS 2008:
In Team Explorer, click on the appropriate team project that you want to check/change
Choose theTeam–>Team Project Settings–>Areas and Iterations
choose the appropriate area. If you don’t have any defined, or you want it to apply to all of them, choose the “Area” node.
Click on the.. button.
The permissions to edit work items is set here: Edit work items in this node

Q25. How to use the blame feature in TFS?

Ans: The TFS equivalent is the Annotate command I believe. (Simply right-click on the versioned file in the source code explorer and select “Annotate”.)
There’s more information on this over on MSDN.

Q26. Tips and tricks to increase productivity/efficiency with Team Foundation Server

Ans: I have to use Team Foundation Server 2010 at my company and I’m not very happy with it. There are so many features or just default behaviour I’d expect from a CVS that TFS seems to lack (compared to svn, git or perforce, which I have experience with), so my question is: which tricks do you know, which hidden features are out there to make TFS easier to use / more convenient?

Perhaps I should elaborate a bit and list what I think could be better:

1. The default check-in action, when associated with a task, is “resolve”, though, in 99% of all check-ins, I only want to “associate” my commit with the task. There’s only 1 commit (the last) that “resolves” the task, so why is that the default? Can I change that?

2. In the check-in dialogue, when double-clicking a file, Notepad is launched and shows the contents of the file. Notepad. Seriously? What about the Visual Studio editor? Anyway, I’d like to see the differences to review the changes I’ve made, not the contents of the file. The diff tool is hidden in a submenu. This might seem trivial, but when I have to check 10+ files it’s just annoying to always right-click, open submenu, click to diff.

3. The diff tool. Merging with it isn’t really straightforward, also the conflict detection mechanism is somewhat lacking. The (Tortoise-)SVN / Git merge tools or that of Perforce are way better here.

4. Creating a new file, opening a file for the first time, comparing a file with a previous version etc takes forever (that is, 3-10+ seconds). Our TFS server is in-house and has absolutely no load – also why does Visual Studio have to contact the TFS server when I just create a new file (which I might not even check in)? Is there perhaps an option to turn that off?

5. Readonly files. All files are read-only when checked-in and become writeable when edited for the first time. This is really annoying when the application crashes because of that. Windows Azure, for example, modifies a web.config file and fails whenever I check out because the file is read-only then.
These are just the most prominent things that I think are really annoying and unnecessary. I didn’t have the pleasure to branch and merge yet, but from what I’ve heard so far it won’t be very enjoyable as well…

So again: If you know some tricks, settings, features that make working with TFS less inconvenient, please share them.
1) is customizable if you reconfigure the work items. (You can also change any combination of fields/states/available values/etc.)

2) is a pain, but if you use the dockable “Pending Changes” window instead then it’ll open the file in the editor. I suspect this is a drawback of the Checkin dialogue being modal.

3) you can customize – the option’s a little tucked away, but it’s on Tools/Options dialogue under Source Control/Visual Studio Team Foundation Server/Configure User Tools. Some third party tools (like BeyondCompare) have pages on their website with details of how to configure them with VS.

4) I’ve not seen the speed problems, although I do agree about the overhead on creating a file. Not sure if that’s configurable.

Q27. Team Foundation Server: How to view changeset history

Ans: I’d like to know how to view the entire changeset history in Team Foundation Server for a given project.
this is what I want to see- starting from changeset 1 all the way to the current changeset:
show me change #, username, date of submission, description, files that were changed, etc.

Note: I don’t want to just see the history for a given file, or dir, I want to see the history for the whole darn thing. i.e., what happened in changeset 1, what happened in changeset 2, what happened in changeset 3, etc.

You can go to the Source Control Explorer in Visual Studio and right-click on your project and select VIEW HISTORY. This will show you the list of all changesets made to that project, who made them, the date they were made, and any comment added to those changesets. if you double-click on any particular changeset, you can see the files that were changed in that one changeset.
edited to add links.

Check Out TFS Tutorials

Q28. Why does TFS prompt me to overwrite every file?

Ans: To work under TFS source control, you will need the following:

1. Your solution must be in source control!
2. Your source control provider must be set to TFS. Tools > Options > Source Control and make sure it’s the default SC provider.
3. You must have a workspace mapping on your local drive that tells TFS where the solution should be located on your hard drive. Open Source Control and there is a drop-down list at the top of the window that shows the currently selected workspace. Drop this combo-box down and it gives an option to edit the workspace, where you can tell TFS where specific folders in its hierarchy are to be located on your hard drive.
4. You need to bind the solution to source control to tell TFS that you want to work in a source controlled way on this solution. (From memory) go to File > Source Control > Change Source Control and usually just clicking the “Bind” button is enough.
5. You may need to synchronise your PC with the server. Open the source control window, right click on the parent folder of the solution, and do a “Get Specific Version”. Set this to “Latest” and tick the checkbox to get files that the source control system thinks you already have. This will synchronise your PC with the network so TFS knows what’s going on. (Note: The other checkbox will cause TFS to overwrite writable files, which could mean you lose any local changes you have made, so take a backup of your code first, and be careful about which options you enable)
I’ve been a bit brief, but if you find you need to do any of the above, I should have given you enough info that you can search the web for more specific help.

Q29. How to Find TFS Changesets Not Linked to Work Items

Ans: Is there a way, either via a query or programmatically, to identify all TFS Changesets that are NOT linked to a Work Item?
Using the TFS PowerToy’s PowerShell module:
From whatever folder in your workspace you’re interested in:

Get-TfsItemHistory . -Recurse | Where-Object { $_.WorkItems.Length -eq 0 }

This will get the history for the current folder and all subfolders, and then filter for empty workitem lists.

Q30. How to get the list of all “Change Sets” of a user in TFS?

I just want to get the list of all changesets of a user in TFS. I want only the id of the changeset and a link to all items which are being checked in as part of that changeset.
How can I do that?
Ans: Besides the option presented by Richard, you can also do that from within VS:

Change Sets

It’s also possible to do it via the API. I can provide a short snippet if you’re interested.

Q31. Get current changeset id on the workspace for TFS

Sure, I can pick one file and view its history. However, if that file was not recently updated, its changeset is probably older than the more recently updated files in the same solution.
One possible mistake that we may make is that we view the history on the solution file, however, the solution file rarely changes unless you’re adding a new project / making solution-level changes.
In the end to figure out the changeset I need to remember what were the latest files changed and view their history.
Is there a better way to do this?
from the root (top) of your workspace, in cmd perform:

tf history . /r /noprompt /stopafter:1 /version:W

Q32. How to merge new files into another branch in TFS?

Ans: Ok, in TFS we have a main trunk branch and another branch, let’s call it secondary. We have created a new file in the trunk but when trying to merge that specific file, it does not give us the option to merge to the secondary branch. We’re assuming that it’s because an analogous file does not exist in secondary.
Is this the cause of the problem and if so, how can we get that new file from the trunk into secondary?
Here, we are merging a file that does exist in secondary. As you can see, the dropdown lists all three of our branches (secondary is actually the middle one):

 merge new files

Now, when I try to merge a file that was created in the trunk after secondary was branched, secondary is no longer listed as a target branch.

source control merge wizard

trying to merge that specific file
To understand TFS it helps to remember that the unit of change is the changeset, and it is changesets (not files) that are checked-in and merged.
We’re assuming that it’s because an analogous file does not exist in secondary
This is correct – at the version (changeset number) that the target branch is at, this file simply does not exist, so there is nothing to merge to.
In general, you don’t gain anything by selecting a particular file in the merge source dialogue – as it says, it asks you to select the source and target branches. Specify the branches at their root, choose selected changesets only, and TFS will show you a list of changesets that exist in the source but have not been merged to target. If you only want the one that added this new file, you can select it in that list.

Q33. TFS shortcut to compare a modified file with the latest version

Ans: Right now I have to pull up the Pending Changes window, right-click on the file and select Compare->With Latest Version… Is there a faster way to look at my modifications?
Keyboard Shortcut for doing TFS Compare:
1. shift+ enter on the file
a)will compare the files
2. shift+ double click on the file
a)will compare the file in the background
3. Create visual studio mapping for the commands:
Set the shortcut for compare folder under Source Control Explorer, you should set the shortcut keys for File.TfsFolderDiff command.
Set the shortcut for compare specific file under Source Control Explorer, you should set the shortcut keys for File.TfsCompare command
Note: To set the keyboard shortcuts, open “Tools > Options”. In the dialogue that opens, go to “Keyboard”. Example:
Note: The folder compare shortcut is only valid from the “Source Control Explorer”. It is the same as right-clicking in the “Source Control Explorer” and selecting “Compare…”.

file command list window


4. TFS Shortcut to do a diff on all modified files with the latest version

Q34. How to “order” tasks in TFS?

Ans: I’m relatively new to TFS and I’ve been trying to figure out how to order tasks as follows:
Task 1
Task 2 (requires that Task 1 be completed first)
Task 3 (requires that Task 1 and Task 2 be completed first)
Is there a way to do this? We are using TFS 2010.
Well. I found it. You can specify that a task is a “Predecessor” or a “Successor” to another task, or multiple tasks when you define the link between the two.

Q35. TFS Shortcut to do a diff on all modified files with the latest version

Ans: I’m looking for a way to kick off a diff on multiple files very easily.
I find it very tedious to have to:
1. Right-click on every file
2. Click compare
3. Click with workspace version.
4. Rinse and repeat for every file in my changeset
Ideally, I’d like to be able to highlight all of the files in my changeset and perform one quick action that launched multiple windows of a diff tool or launches them one after the other.
It’s probably good to know that my question is very similar to this question but I’m looking for a way to do this in bulk.
Use the TF COMMAND LINE UTILITY. It comes with Visual Studio. You’ll have a special command prompt with the tools loaded called “Visual Studio Command Prompt (2010)” in the Start Menu. You should cd to the root directory for the solution. This way you don’t have to provide the commands with a server name, credentials, or workspace information. It will pick it up automatically.
I ran the DIFFERENCE COMMAND. Without any parameters, it automatically shows the diff for every pending change.
D:my-project> tf diff
As you close the diff window, the next change will pop up.

Q36. TFS Merge And Keep The Associated Changesets/Comments

So let’s say I’m working in a development branch and I checked in a change, supplied a comment, and associated a work item. Now I want to merge that back to Main, is there a way I can have TFS merge know to associate that same work item and comment by default when I attempt to check it in?
Seems trivial but scale this out to multiple changesets a day and recording the work item numbers to reselect gets very tedious…
Ans: TFS has, in my opinion, a weakness on this one. All TFS-guides out there suggest that a multiple-branch scheme should be applied – which is absolutely reasonable (see HERE for a great reference).
Developers shall be working in ‘playground’ branches & once tests have succeeded, changesets are propagated into moree stable – more Release-near branches.
A somewhat duplicate question on that is this one.
According to the answers, and EXTENSION by J.Ehn could do what you‘re after on the link-to-WI aspect. No evidence shows that the add-comments aspect is somehow included – yet this might not make tremendous sense (what should happen if the merge contains multiple commits from the DEV-branch?). Still, it should be possible to fork this implementation and add the comments as well.
In the same question, E.Blankenship provides a rough road to ANOTHER alternative.

Q37. How can I always block check-in of a specific file in TFS?

Ans: There is one file that I always made changes to, but that I never want to be checked in. I would like TFS to block me from ever checking it in or committing the changes. How can I configure TFS to do this?
Details: There is another developer on the project that has checked in some bad code that I prefer to comment out on my local machine. Since they are a client, I prefer to keep this a technical exercise rather than make it a political one.
Visual Studio 2013 (and 2012)
This feature is available by selecting the file(s) and going to:
File > Source Control > Advanced > Exclude … from Source Control

Q38. Team Foundation Server – TF Get with changeset number

Ans: I’m trying to write a very lightweight “build” script which will basically just get a few files from TF (based on a Changeset number). Then I’ll run those files in SQLCMD.
I’m using this:
tf.exe get c:tfs  /version:c2681  /force /recursive
However, this appears to get EVERYTHING, not just the files in changeset #2681. I’d like to be able to point it to the root of my TFS workspace, give it a changeset number, and have it just update those few specific files. Also, it appears to be getting older versions (perhaps what was current when changeset #2681 was checked in)?
Is there a way to get just those specific files, WITHOUT needing to call them out specifically in the tf get item spec?
EDIT: I actually had to add the /force option in order for it to do anything at all. Without force, it doesn’t appear to even retrieve from the server a file I deleted locally, that’s definitely in the changeset.
thanks, Sylvia
Everything mentioned in Jason’s and Richard’s posts above is correct but I would like to add one thing that may help you. The TFS team ships a set of useful tools separate from VS known as the “Team Foundation Power Tools”. One of the Power Tools is an additional command line utility known as tfpt.exe. tfpt.exe contains a “getcs” command which is equivalent to “get changeset” which seems to be exactly what you are looking for.
If you have VS 2010, then you can download the tools HERE. If you have an older version, a bing :) search should help you find the correct version of the tools. If you want to read more about the getcs command, check out Buck Hodges’s post HERE.

Q39. How can I find all of the labels for a particular TFS project sub-folder?

Ans: Assume there is a TFS project Project with the subfolders trunk and 1.0. trunk contains the latest version of the application code for this project and 1.0 contains the code for the same application for the released version of the same name.
There are labels for both sub-folders and all of the labels include files in only one of the sub-folders. [You could also assume that the labels are recursive on a specific (maximum) changeset for all of the files in the entire sub-folder too if that simplifies your answer.]
How can I create a list of labels for one of these sub-folders, using Visual Studio, the TFS tf.execommand line tool, or any other tool or code that is publicly (and freely) available.
Note I’ve written T-SQL code that queries the TFS version control database directly to generate this info, but I’m curious whether there are ‘better’ ways to do so.
In Visual Studio, in the Source Control Explorer window, right-click the sub-folder for which you want to list the relevant labels and pick View History from the context menu. In the History window that should appear, there should be a sub-tab Labels that lists labels applied to that sub-folder (but not specific items in that sub-folder).

Q40. TFS file must remain locked

Ans: I have some 3rd party DLLs checked into TFS
Our machines were renamed and now TFS believes they are checked out for edit by me on another machine.
I tried to lock /lock: none contrib64/* /workspace: old machine; my username but I get the error
TF10152: The item $/XXX/YYYY/contrib64/third_party.dll must remain locked because its file type prevents multiple check-outs.

  • Is there any way around this?
  • Is TFS really this bad or is it just me?
  • Is the purpose of TFS to make us nostalgic for VSS?

ps, It’s a hosted version so I can’t just get the admin to fix it.
Undoing the lock won’t work on those files because they are binary, as binaries cannot be merged they must be locked if they are checked out.
As the machine the workspace resides on no longer exists (the machine has been renamed) the best thing to do is delete the workspace.
from a Visual Studio command prompt

tf workspace /delete oldmachine;myusername /collection:https://*tfsserver*:8080/tfs/*collection*

This will remove the workspace and undo all pending changes

Q41. Difference between Product Backlog Item and Feature in Team Foundation work item types

Ans: I have a question about Microsoft Team Foundation. In Visual Studio, Team Explorer, I can create a new work item. Work item types here are dictated by your team’s chosen process template; I’m not sure which process template we’re using. In any case, in Team Explorer, when I want to create a new work item, I’m given a list of work item types to select from, among which are “Product Backlog Item” and “Feature”.
I noticed a difference between the two types related to the target resolution date. For a Product Backlog Item, this would seem to be dictated by the iteration end date. For a Feature, it’s not as clear. A Feature is also associated with an iteration (and iteration end date), however, Feature also has a separate field called “Target Date”. The mouse hover text for the target date is “The target date for completing the feature”.
Should I choose “Product Backlog Item” or “Feature” as the work item type for my new work items? What’s the difference between the two?

work items

It looks like you are using the Scrum process template. The TFS site has published some very brief information about Product Backlog Items and Features and the idea behind creating a new work item type. 

The difference between the two comes down to what granularity you want to work with your work items at:

Product Backlog Items are composed of Tasks and have estimated effort.
Features are composed of Product Backlog Items and have target dates.
I have not been able to find any official guidance on when to use Features vs Product Backlog Items.

Should you create a Feature or a Product Backlog Item?

If you think/hope that the new work item that you are going to create will fit into a single sprint you should create a Product Backlog Item and then break it down into tasks for your sprint.
If you think/know that the new work item won’t fit into a single sprint you should create a Feature and identify all the value-providing sprint sized items (Product Backlog Items) that the Feature can be broken down into and use these when planning future sprints.
[Update 2014-05-19]
Microsoft has published more information on how to use Features and the agile portfolio concept that has been implemented in TFS 

Q42. Warning displayed when adding the solution to Team Foundation Server 2010

Ans: I’m just getting to grips with TFS 2010 (never had any luck with TFS 2008) and I’m trying to add my first solution into TFS. However, I am getting the following warning message:
The project that you are attempting to add to source control may cause other source control users to have difficulty opening this solution or getting newer versions of it. To avoid this problem, add the project from a location below the binding root of the other source controlled projects in the solution.
Can someone explain to me what this means and how to resolve it? This warning is displayed when right-clicking on the solution in Solution Explorer and selecting “Add to Source Control”.
Your solution folder structure should resemble:
Skip code block
Solution Root folder
.sln solution file
Project1 folder
Project1.csproj   (or .vbproj)
Project2 folder
Project2.csproj   (or .vbproj)

Q43. How to undo another user’s checkout in TFS via the GUI?

Ans: As the resident TFS admin, on occasion, I am asked to undo a checkout (usually a lock) that a user has on a certain file. This can be done via the command line using the TF.exe utility’s

Out of the box, no, but there are at least a couple of options via add-ons:
The latest version can be downloaded HERE. Also includes links to older versions.
Once installed:

  1. Open Source Control Explorer
  2. Right-click the item on which checkout is to be undone (or a parent folder of multiple files to be undone)
  3. Select Find in Source Control and then Status
  4. In the Find in Source Control dialog, leave the Status checkbox marked
  5. Optionally, enter a value for the Wildcard textbox
  6. Optionally, enter a username in the “Display files checked out to:” textbox and select that radio button
  7. Click Find
  8. This will result in a list of files
  9. Select the items to undo
  10. Right-click and select Undo
  11. Click Yes when prompted with “Undo all selected changes?”

It has a Status sidekick that allows you to query for checked out work items. Once a work item is selected, there are “Undo pending change” and “Undo lock” buttons that can be used.

  1. Keep in mind that you will need the appropriate rights. The permissions are called “Undo other users’ changes” and “Unlock other users’ changes”. These permissions can be viewed by:
  2. Right-clicking the desired project, folder, or file in Source Control Explorer
  3. Select Properties
  4. Select the Security tab
  5. Select the appropriate user or group in the Users and Groups section at the top
  6. View the “Permissions for [user/group]:” section at the bottom

Q44. How to undo other user's check out in TFS?

Ans: As the resident TFS admin, on occasion, I am asked to undo a checkout (usually a lock) that a user has on a certain file checked into source control.
How do you undo another user’s checkout?
There are at least 2 different ways to do this:
Command Line
There is a command-line utility called Tf.exe that comes with Team Explorer. Find the documentation HERE. It can be accessed by launching a Visual Studio Command Prompt window. The syntax of the command is:
tf undo 

[/server:servername] [/recursive] itemspec [/noprompt]

For one file

tf undo /workspace:workspacename;workspaceowner $/projectname/filename.cs

The second is via the GUI, but does not come standard – you have to install the TFS POWER TOOLS. See here for details on how to use this method.
Keep in mind that with either method you will need the appropriate rights. The permissions are called “Undo other users’ changes” and “Unlock other users’ changes”. These permissions can be viewed by:
1. Right-clicking the desired project, folder, or file in Source Control Explorer
2. Select Properties
3. Select the Security tab
4. Select the appropriate user or group in the Users and Groups section at the top
5. View the “Permissions for [user/group]:” section at the bottom
Deleting the workspace

tf workspace /delete WorkspaceName;User

Q45. What’s a Backup and Recovery Process for Team Foundation Server 2010?

Ans: We have a new installation of TFS 2010 (on SQL Server 2008), and I’m planning the backup and recovery process.
It seems the configuration information and data are stored in the Tfs_Configuration and Tfs_DefaultCollection databases (and additional Tfs_[CollectionName] DBS if you have more than one collection). In a test setup, I tried backing up the two DBS, uninstalling TFS, then reinstalling (thinking I could then hook the databases up at some point in the install process). This is where I’m confused. I don’t see an option or clear guidance on how this is supposed to work.
Download the TFS POWER TOOLS and USE THE BACKUP TOOL (it’s even got a nice GUI)!
If you have backed up your TFS 2010 databases and lose your TFS server, you can restore it by restoring all of your TFS databases, reinstalling TFS, and selecting the Application Tier option of the installation wizard. Once you point the wizard at your database, it will recognize the Tfs_Configuration database from the previous installation and restore your previous configuration as well as your collections.

Q46. Conchango vs MS agile template on TFS 2010

Ans: I have just written a blog that gives you a side by side comparison between:

  1. Scrum for Team System v3
  2. MSF Agile v5
  3. TFS Scrum v1 (beta)

Q47. Can we migrate to a new TFS process template and keep history?

Ans: We are currently using TFS 2008 with the Scrum for Team System template from Conchango, with a few minor tweaks. We are looking at upgrading to TFS 2010 and we are considering moving to the MSF for Agile template.

What is the best way to move to a new process template and keep history? I’d like to be able to create a new team project on the TFS 2010 server, get everything checked-in, and move our source to the new project. It would be nice if we could somehow keep the check-in comment history and possibly even be able to navigate back to the work item history associated with a changeset in the old project. I’d even be willing to migrate the old project as-is over to 2010 and then move the source to a new project, retaining the old project with work items only in 2010.

Has anyone gone through the process that can over some advice?

We are in a similar situation that you are (right down to the templates we are on versus the one we want to be on), although we only have source code in our existing Team Foundation Server instance. We are planning to do a migration from Team Foundation Server 2008 to Team Foundation Server 2010, as opposed to an upgrade. Although we have not done so yet, you do have the have two options you have outlined.

As you mention, you can migrate the source code and Work Item Tracking to a new Team Project using this tool. It will “compress” the history dates, as TFS will want to add its own timestamp. There will be some potential history issues, from what I understand. Specifically, in TFS 2010, you might have issues comparing versions from the pre-migrated source control. At least, so far, I have in my experiments in our test lab. My understanding of this issue is that it relates to item-mode vs. slotted-mode as the defaults between the two versions. I can look at individual versions and can see history – so that meets our requirements.

The other option is source control in one project and work items in another. I have not tried this, because I would imagine that the changeset relationships would be broken on existing work items and would not be generated going forward. This may or may not be a big deal to you.

Also, it might be a good idea to describe your situation in the discussion area of the project on Codeplex. The authors are on the TFS Migration Team at Microsoft and depend on feedback of people in the same boat we are. I have been exchanging a couple of emails with them so far, and they have been quite helpful.

Based upon our discussions with the very helpful folks at Microsoft, we are likely going to backup the databases and follow the directions on BRYAN KRIEGER’S BLOG POST (Path 2: Migration Upgrade). I am hoping to make a test run at the upgrade using an older backup as early as next week.

Best of luck! I know it is intimidating. Luckily, my installation and configuration experiences with a fresh TFS 2010 install in the lab have been much more smooth than my initial exposure to the TFS 2008 process. Hopefully, you find the same is true.

Q48. TFS 2010 enforcing Code Analysis in Gated Check-ins

Ans: Hi Is it possible to enforce VS Code Analysis (FxCop) as part of the Gated Checkin policies? So the developers will not be able to checkin unless the CA is passed.
Yes, this is possible. Please see the following:

Q49. How to revert (Roll Back) a checkin in TFS 2010

Can anyone tell me how to revert (rollback) a checkin in TFS 2010?
Ans: Without using power tools or command line:
1. ensure Tools->Options->Source Control->Visual Studio Team Foundation Server UNCHECK Get the latest version of item on check out
2. View the history of project folder in Source Control Explorer and right-click on the changeset to roll back to and choose to Get This Version
3. Check out for edit on the project folder in the Source Control Explorer (this should keep the local version you just got from the history)
4. Check-in pending changes on the project folder in the Source Control Explorer
5. if visual studio asks you to resolve conflicts, choose to keep local and attempt to check in of pending changes on the project folder in Source Control Explorer again

Q50. Why should my small .NET development company upgrade from Team Foundation Server 2008 to 2010?

Ans: The company for which I work has an MSDN site license and upgrading to TFS 2010 from 2008 is not an expensive option. However, neither my colleagues nor I have been able to find any features that make this something we feel we need. Is anyone experienced with TFS 2010 enough to convince me that my company needs this?

To clarify: we have no intention of moving to a different source control product. The question is what features of TFS 2010 are worth an upgrade from TFS 2008?

Disclaimer: I haven’t moved to 2010 yet either, but probably will
The biggest feature for me: (we use branching to manage large feature sets and to separate SPs, QFE’s, and major releases)
TFS 2010 will track changes across branches.

Example: suppose I change something in the Dev branch, and then you merge dev to main. Now suppose that someone uses the Annotate feature (on the main branch) to figure out who changed that code. In TFS 2008, it would report that you made the change (because you checked in the merge). Reportedly, TFS 2010 will be aware that I actually originated the change in the dev branch, and it will be able to tell you that. That’s gold if you are using branching.

Also, correct me if I’m wrong, but didn’t they switch 2010 to use a single SQL database? (or maybe 1 for source control, and one warehouse?). If so, then the backup strategy gets a bit better. MS says that all of the TFS databases should be backed up from the same moment in time, but that’s tough to do when there are 5-odd databases (it’s very difficult to ensure that all of them reflect exactly the same point in time transactionally). If they have consolidated databases, then it should be easier.
One other: depending upon the level of MSDN that you have, TFS 2010 might be free for you now.

Q51. How can I get TFS 2010 to build each project to a separate directory?

Ans: In our project, we’d like to have our TFS build put each project into its own folder under the drop folder, instead of dropping all of the files into one flat structure. To illustrate, we’d like to see something like this:
This is basically the same question as was asked here, but now that we’re using workflow-based builds, those solutions don’t seem to work. The solution using the CustomizableOutDir property looked like it would work best for us, but I can’t get that property to be recognized. I customized our workflow to pass it into MSBuild as a command-line argument (/p:CustomizableOutDir=true), but it seems MSBuild just ignores it and puts the output into the OutDir given by the workflow.

I looked at the build logs, and I can see that the CustomizableOutDir and OutDir properties are both getting set in the command line args to MSBuild. I still need OutDir to be passed in so that I can copy my files to TeamBuildOutDir at the end.

Any idea why my CustomizableOutDir parameter isn’t getting recognized, or if there’s a better way to achieve this?

I figured out a nice way to do it. It turns out that since you can set the OutDir to whatever you want within the workflow, if you set it to the empty string, MSBuild will instead use the project-specific OutputPath. That lets us be a lot more flexible. Here’s my entire solution (based on the default build workflow): In the Run MSBuild task, set OutDir to the empty string. In that same task, set your CommandLineArguments to something like the following. This will allow you to have a reference to the TFS default OutDir from your project:

String.Format(“/p:CommonOutputPath=””{0}”””, outputDirectory)
In each project you want copied to the drop folder, set the OutputPath like so:


Check everything in, and you should have a working build that deploys each of your projects to its own folder under the drop folder.

Q52. TF203015 The Item $/path/file has an incompatible pending change. While trying to unshelve

Ans: I’m using Visual Studio 2010 Pro against Team Server 2010 and I had my project opened (apparently) as a solution from the repo, but I should’ve opened it as “web site”. I found this out during compile, so I went to shelve my new changes and deleted the project from my local disk, then opened the project again from source (this time as a web site) and now I can’t unshelve my files.

Is there any way to work around this? Did I blow something up? Do I need to do maintenance at the server?
Of course, I can’t find an error code for TF203015 anywhere, so no resolution either (hence my inclusion of the number in the title, yeah?)

EDIT: I should probably mention that these files were never checked in in the first place. Does that matter? Can you shelve an unchecked item? Is that what I did wrong?
EDIT: WHAP – FOUND IT!!! Use “Undo” on the items that don’t exist because they show up in pending changes as check-ins.
Need to close, found the answer.
I had deleted the files in trying to reload the workspace, even though I had shelved the changes. Then VS2010 thought those files were still pending to save. I didn’t need that, so I had to figure out to “undo” the changes in Pending Changes.
Then I could unshelve.
It thought I had two ops (unshelve, commit-for-add) going simultaneously, and I thought I had only one op (unshelve).

Q53. Share code between projects in TFS 2010

Ans: what is the best way to handle code sharing in TFS 2010? We have a couple of Visual studio projects that other Visual Studio projects use ex:

  • Shared Project
  • Project 1 Solution
  • Shared Project
  • Project 1 Project
  • Project 2 Solution
  • Shared Project
  • Project 2 Project

Also, we have Third-party code for example:

  • Telerik
  • 2009.1.402.35
  • 2009.02.0701.35

When I open my “Project 1” solution I want my shared code project to be included in that solution. (that's the way we work today).
We basically have one TFS Project that contains all the code. Now we want to use it the “right” (?) way, We would like to have Project 1 and 2 in separate TFS solutions.
If I, for example, makes sure we have all our project in the same structure on disk and just add the shared project to my Project 1 solution (even if the projects reside in two different TFS Projects) would that work with builds?

Q54. Standalone GUI client for TFS 2010 Source Control

Ans: I’m looking for a TFS 2010 GUI client that I can use outside of an IDE. I’m only looking to use the source control features in this case. I’m not talking about work items or building management.

Ideally, it would be a complete client that can be used on a machine where Visual Studio is not installed.
Options I know about and why I’m not satisfied with them:

Must have a working copy to use… see CHICKEN OR THE EGG
Missing features: view history, branch/merge, revert
TFS 2010 not yet supported
Are there others that I don’t know about?
You can install Team Explorer (on the TFS install DVD, or you can download it FROM MSDN) without needing to have VS2010 installed – Team Explorer will install a ‘shell’ VS2010 with only the TFS features available – none of the IDE components.

Update: the VS11 BETA version is now available.

If you use eclipse I’ve heard good things about the team prize stuff but haven’t tried it myself. They got bought by Microsoft and now you can download the eclipse plugin HERE It also looks like it has a fully functional command-line client that you could use instead of TFS Power Tools.
From the description: “Eclipse plug-in and cross-platform command-line client for Visual Studio 2010 Team Foundation Server”

Q55. How can I copy a TFS 2010 Build Definition?

Ans: Is there any way to copy a build definition? I work in a mainline source control methodology that utilizes many different branches that live for very short periods (ie. a few days to a week). I’d really like to copy a build template and just change the solution to build. Is there any way to do this?

You can write an add-in to do it. Here’s the code to copy an existing build definition:
Skip code block

static IBuildDefinition CloneBuildDefinition(IBuildDefinition buildDefinition)
var buildDefinitionClone = buildDefinition.BuildServer.CreateBuildDefinition(
buildDefinitionClone.BuildController = buildDefinition.BuildController;
buildDefinitionClone.ContinuousIntegrationType = buildDefinition.ContinuousIntegrationType;
buildDefinitionClone.ContinuousIntegrationQuietPeriod = buildDefinition.ContinuousIntegrationQuietPeriod;
buildDefinitionClone.DefaultDropLocation = buildDefinition.DefaultDropLocation;
buildDefinitionClone.Description = buildDefinition.Description;
buildDefinitionClone.Enabled = buildDefinition.Enabled;
buildDefinitionClone.Name = String.Format(“Copy of {0}”, buildDefinition.Name);
buildDefinitionClone.Process = buildDefinition.Process;
buildDefinitionClone.ProcessParameters = buildDefinition.ProcessParameters;
foreach (var schedule in buildDefinition.Schedules)
var newSchedule = buildDefinitionClone.AddSchedule();
newSchedule.DaysToBuild = schedule.DaysToBuild;
newSchedule.StartTime = schedule.StartTime;
newSchedule.TimeZone = schedule.TimeZone;
foreach (var mapping in buildDefinition.Workspace.Mappings)
mapping.ServerItem, mapping.LocalItem, mapping.MappingType, mapping.Depth);
foreach (var policy in buildDefinition.RetentionPolicyList)
policy.BuildReason, policy.BuildStatus, policy.NumberToKeep, policy.DeleteOptions);
return buildDefinitionClone;

Q56. Is MSBuild going to be dead because of Windows Workflow?

Ans: MSBuild in TFS 2010 has been replaced by Windows Workflow 4.0. It means when you are creating a Build Definition, you won’t have a TFSBuild.proj to edit instead you must edit a workflow to customize your build.

BTW am I correct if I say Microsoft is not supporting MSBuild in TFS 2010 and learning MSBuild as a TFS 2010 Team Build administrator doesn’t worth it?
And another more question: is Microsoft going to replace Visual Studio Projects’ language from MSBuild with something like Windows Workflow?

I’m the Program Manager for the build automation features of TFS, so I’d like to comment on this question. We haven’t replaced MSBuild with Windows Workflow (WF). We still very much rely on MSBuild as the core build engine, which is its core competency. You’ll find that there are lots of tasks that are still most easily and effectively automated with MSBuild.

We introduced WF as a way of providing a higher level orchestration layer on top of the core build engine (which is MSBuild in the build process templates we include in the box). It makes it possible to do things like distributing a process across multiple machines and to tie the process into other workflow-based processes.

So, when should you automate with MSBuild and when should you automate with WF? Here’s my general guidance on that subject:
1. If the task requires knowledge of specific build inputs or outputs, use MSBuild
2. If the task is something you need to happen when you build in Visual Studio, use MSBuild
3. If the task is something you only need to happen when you build on the build server, use WF unless it requires knowledge of specific build inputs/outputs

When using MSBuild, remember that you can customize your project files directly (by unloading them and then editing them in Visual Studio), or you can create custom .targets files and import them into your individual projects. The latter approach is useful for functionality that’s common to multiple projects to avoid maintaining multiple copies.

When using WF, remember that you can write code activities for low-level tasks but that you can also compose higher-level tasks using straight XAML. We’re actually working on a version of the default build process template that shipped with TFS 2010 that gives you a simpler, less granular view of the overall process by using a set of composed XAML activities.

Q57. Using the edit – merge – commit workflow in TFS Source Control

Ans: I've been using source gear vault and subversion/visual svn for quite a while now and am a big fan of the CVS disconnected style “Edit -> Merge -> Commit” way of using source control.
Since we moved to TFS 2010 I have been reintroduced to the horrid “checkout -> edit -> checkin” SourceSafe style way of working. Meaning only one user can work on a file at any time.
I can't find anything that suggests this can be changed.
Is it possible?
Checkouts in TFS aren’t generally exclusive. By default, multiple users can checkout a single file. Exceptions are binary file types like JPGs, PNGs, etc. which are checked out exclusively by default.
Once you’re ready to commit your changes, you can use the Pending Changes tool window to check for conflicts and merge if necessary.

Q58. How to Add/Edit the Iteration Field in Team Foundation Server Scrum v1.0 beta Workflow

I downloaded and installed the new Team Foundation Server Scrum v1.0 beta work template from Microsoft. I would like to edit the drop-down that displays in the Iteration field used when entering a new Sprint work item. If I enter in a release/sprint number that does not exist I get the following message.
“New Sprint 1: TFS20017: The ara or iteration provided for field ‘Iteration Path’ could not be found”
Does anyone know where I need to go to edit this listing?
Ans: Connect to TFS.
1. In Team Explorer, select the team project you want to define the iterations for.
2. Click on theTeam menu item in the Visual Studio menu bar.
3. Choose theTeam Project Settings sub-menu
4. ChooseAreas and Iterations…
5. Add sub-nodes as necessary for areas or iterations.
Areas and Iterations are defined on a per-project basis, so if you are in one team project when you define them, you won’t be able to access them from another team project.

Q59. Move projects between collections in TFS 2010

I’d like to move some projects between collections but the only resources I’ve found are these two and they don’t address how to do this in TFS 2010:
Does anyone know of any other resource or has information on how to move a project from one collection to another?
Ans: You could look at the TFS INTEGRATION PLATFORM (formerly called the TFS to TFS Migration Tool). That has utilities for moving source code from one instance of TFS to another, which should work if you want to move from one collection to another as well.

Q60. Error TF218027 when creating a Team Project in TFS 2010

Ans: Consider the scenario of a user creating a new Team Project. The user is a developer who wants to create and manage their Team Project.
Why can’t this user create a new Team Project, including the Reporting Services components?
What can be done to resolve this error?

The exception is
TF218027: the following reporting folder could not be created on the server running SQL Reporting Services.
SQL Reporting services are running under an Active Directory service account created expressly for this purpose.
The developer attempting this action is a member of a TFS group with the following permissions.

I actually BLOGGED about this not too long ago. You usually see this error if Reporting Services gets set up with something other than the NETWORK SERVICE account.
I was playing around with my test instance of Team Foundation Server today, trying to create a new project, when I got an error TF218027 when it tried to create the Reporting Services folder for the project. The strange thing was, this was not my first project created on this server.

I searched the Internet for anything similar and found a post that said Reporting Services should be run with the NETWORK SERVICE account. Since this was a hastily put together server, I was running it with the Administrator account, so I tried switching it over.

No dice. I got the same TF218027 error, but this time it was due to it not being able to decrypt the symmetric keys. Apparently, it’s a bad thing to change the account on the Reporting Services service.

I hastily changed the account back to Administrator and restarted the service. Interestingly enough, this seems to have fixed the problem.

Q61. Can’t manually add files to TFS

Ans: We use Codesmith to generate some code, and when we open up the projects, the files are there, in the solution, but there is no way to check them in. The DLL compiles just fine. The only difference to the .csproj is the addition of any new files we generated.

But unlike VSS, TFS does not detect these files. I validated this behavior by editing the .csproj manually. For some reason, the only way to add a file to TFS is through Visual Studio.
However, when I remove them from the project and then include them, I get the usual yellow plus sign.

You can manually add files to Visual Studio, however changing your project file isn’t the best way to do this. If your project is already under source control and the files you want to add are visible in the Solution Explorer window, you can simply right-click a file and select Include in the project. The next time you check your code in, the items will be added.
Since you’re using TFS 2010, check out the TEAM FOUNDATION SERVER POWER TOOLS extensions. This includes the Windows Shell Extensions which give you integration into Windows Explorer which lets you right-click on files or folders and add them to TFS outside of Visual Studio. Very nifty!

Q62. Fetching the comment history for a work item in TFS

Ans: In most defect trackers there is a comment history associated with a ticket/incident/issue/work item.
I wish to get this same information from TFS via the SDK for a work item – ideally:
1. Who created the comment.
2. The text of the comment.
3. Who last updated/edited the comment (if that’s event possible in TFS?)
I have determined that a WorkItem has a collection of revisions available via the “Revisions” property, and that you can loop through each revision – but a revision does not have a “History” property where I assume I could find the comment created by the user. Also, I don’t believe it’s compulsory to record a comment with each change – so I suspect I will need to ignore revisions that don’t have any history property information?


Any thoughts on the best way to fetch this “comment history” information for a work item in TFS – is the revisions list the correct way, or should I be using some other part of the API?

A: In order to fetch the comment history you need to access the “History” property on the Work Item revision.
Obviously, the current (latest) version of the work item will have this field as empty, but historical revision comments will be there.
The “History” displayed on a work item in Team Explorer is built by looping through the Revisions and displaying both the fields that were changed and the text in the “History” property

Q63. Getting “Failed to create mapping” when adding a solution to TFS source control

I’ve created a new Team Project in TFS, but when I try to add my solution to it I get:
‘Failed to create a mapping
Cannot map server path, $/Finance/MyApp, because it is not rooted beneath a team project.’
I can’t find anything on google or here that looks remotely like this problem.

Ans: I had this issue when using Microsoft’s Team Foundation Service from Visual Studio 2012. I had just created the new team project via the TFS website. Although I could see my new project in the ‘add solution’ window, I got the error the OP reported.
I had to go into the “Team Explorer” window, then into “Connect to Team Projects” and tick the new project. Then I was able to add my solution to the team project.

Q64. Why TFS does not allow multiple collections to be connected with a single same Build Controller?

Ans: According to HERE and HERE TFS 2010 does not allow multiple project collections to use a same Build Controller. Why? I’m going to set up some another more build controller as virtual machines. But it seems somehow not practical. Because our company is going to have several project collections. Is it a good workaround? Is there any better workaround except that using a single project collection for all projects?

You should use a new collection when you want isolation. Examples of why you want it is:
1. Security
2. Handover
3. Isolation for multiple customers

Q65. Configuring TFS2010 so users can create/update bugs but modify nothing else

Ans: Environment: I am the administrator of a project in TFS 2010, but don’t have any administrative rights for the project collection.
Is there an easy way that I can set up access rights for a group of users so that they can:
1. Create/update “Bug” work items only
2. View all other work items
3. Execute work item “Team Queries” and create their own queries
4. No access to source control
The idea is I want them to enter bugs, but I don’t want them creating/modifying User Stories or Tasks, nor do I want them to have access to source control.
From what I can see, the standard groups don’t have fine enough control:
Contributors can create all work item types
Readers can view files in Source Control as well as work items.


Limiting access to Source Control is covered by Ewald’s answer.
However, Ewald also indicates that there isn’t a realistic way to set up security on the “Work Item Type” level so that users can only enter/update bugs. He suggests it could be achieved by customising every work item definition and setting field rules for every field on every work item type, but this is a lot of work, and in any case I want to avoid customising the process template.
I’ve therefore created an issue on Connect for this:

Having recently migrated from VSS to TFS2010 I haven’t looked back. I love the way everything is integrated. Without restating what was said before some of the great features are:
1. Proper branching & merging
2. AD integration, no more setting up users in VSS
3. Easy to see who has what checked out
4. Easy to see check-in history (great for code reviews)
5. TFS Power Tools add custom check-in policies and Windows Explorer context menu
6. Work items, tracking, and their association with changesets
7. Inbuilt reporting
8. Team Project Portals – so non developers can access TFS reports/work item info etc
9. Speed, it’s so much faster than VSS
10. The source is stored in SQL server and check-in operations are transactional and not file based, no more running VSS clean up
I found that rather than migrating source code using the migration tool a fresh check-in was the quickest way, keeping SourceSafe in read-only for the odd time I have to refer to the history.

Q66. Set up user permissions for Team Foundation Server 2010

Ans: We have installed TFS 2010 with success but wonder how to set the user's permissions. We are small projects with five developers, a manager, and a secretary. Each developer is working itself with one or more projects, we have no cooperation between any projects. We want everyone to be able to see all the code for each project, but that only those who are responsible for the code to change it. However, we want everyone to create Work Items for all projects. 

If you want a user to be able to read the source code you have to give him/her only Read permission and to prevent him from changing code you have to deny check out and check in permissions. You can set these permissions by right clicking the folder or file in Source Control Explorer, Clicking Properties and clicking Security tab.
For Work Items, you have to give WORK_ITEM_WRITE and WORK_ITEM_READ permissions. You can do this by right-clicking the project in Team Explorer, clicking Areas and Iterations, and on the Area tab, clicking Security

Q67. Adding a parameter to “Queue New Build” Dialog

Ans: I built a custom build processes template based on the DefaultTemplate.xaml and added a few parameters. They show up fine on the Build definition window but I can not find a way to have them be displayed on the Parameters tab of the Queue New Build Dialog.
I am hoping that this is possible, I would rather not need to define a separate build for each variation of parameters.

You can define that in the Metadata parameter: 

You can play with the “View the parameter when” option at the bottom

Q68. Branching in TFS 2010 and being forced to re-download the code

Ans: When I create a branch from the mainline in TFS 2010 I have to download all of the code I have just branched.
I already have the latest mainline version on my laptop so why is TFS requiring me to effectively download what's already on my hard disk?
Even if i copy the mainline files into a folder and map the new branch to this folder it still performs a fully recursive get and chokes our bandwidth for 30 minutes or so.
This seems like such a waste of time and bandwidth – is their a workaround/procedure that I am not aware of?

For faster switching between branches, give the tf get /remap option a try. From Brian Harry’s blog:
This is a new option on tf get that is intended to be used when you want to switch your workspace from one branch to another in the same code base. You first change the workspace mapping and then issue a tf get /remap. Because a large percentage of the files in two related branches are frequently identical, this command optimizes for that. Rather than downloading all the content, it will only download the things that are different between the two branches. I can reduce the get of a very large workspace from 10’s of minutes to a few seconds.

Note that this requires TFS 2008 SP1 or later.

Q69. How to update current sprint team queries in TFS 2010?

Ans: We are using VS 2010 and TFS 2010 with the Microsoft Scrum template.
We use the Team Queries for the Current Sprint like the Sprint Backlog query.
The problem is when we move to sprint 2 the “Current Sprint” still points to sprint 1.
Is there a way to tell TFS that we are now currently in sprint 2 and have the queries use a variable to run against instead of hard-coding the sprint?
For example: If you look at the screenshot below you will notice that the definition of the query uses a variable called “@Project” for the team project. Is there a way to have a variable for the sprint?

sprint team queries

Tom, What you are asking for is not available in TFS 2010. There are not even dates on the iterations, so TFS does not know what the current iteration is.
In TFS11 (vNext) we have added the dates on the iterations. It now knows in which iteration you are, and this is also reflected on the backlog page in web access. In the preview version that is out now, it is however not possible to add a filter clause to your queries to filter on the current iteration (something like @CurrentIteration). We have heard strong feedback to add this to the product before it ships. It is also very high on our wish list, but we need to fix other things first before we can ship.
You can add this request on USER VOICE. If the idea gets lots of votes it makes it easier to build a case that we need to put this in. But we cannot promise anything.
Ewald – TFS Program Manager

Q70. Removing branch mapping in Team Foundation Server 2010

I’ve got a solution in source control with multiple projects. When I first migrated old code to TFS, I created main, dev, release areas for branches. Being new to TFS at the time, I branched a single project to the dev area, which created the little silver branch icon to show the relationship between them. Having done that, of course, I can no longer branch above or below that spot. So, I can’t branch a whole solution.

I tried removing the mapping/association of branches so that I could branch from higher in the tree, but can’t find a way to do that. I backed up source control and deleted all other associated branches except for the original one in the Main branch, but the association is still there despite having deleted the others (I assume TFS still contains a history of those associations to the other branches I created).

My question is: How do I safely remove branch associations (the silver branch icon) while keeping history if possible (I don’t care about being able to merge anymore), so that I can branch from another area higher or lower in the tree?

Ans: Evidently, the right-click menu does not have this option due to user feedback. It can be accessed via File > Source Control > Branching and Merging > Convert to Folder

Q71. Email Notifications/Alerts from Builds in TFS 2010

I am having problems getting the team alerts to work in TFS 2010.
Under “Team > Project Alerts”, I have checked the box to send both myself and a colleague an email upon a completed build. I know I have entered the correct email addresses, correct syntax as far as separating the emails, yet neither I nor my colleague receives any emails when the build is complete.
So far, I haven’t found anything online regarding troubleshooting this issue. I was wondering if anyone has encountered the same problem or otherwise knows of a solution to this problem.

Ans: Usually, this boils down to a configuration problem within the TFS setup.
If you have access to the TFS server, run the TFS Administration Console.
If you click on TFS / Application Tier on the left, you’ll see the Application Tier settings come up. Scroll down to the Email Alert Settings.
Make sure it’s enabled and has the correct configuration for sending messages.

Q72. Can you do a TFS get without needing a workspace?

I’m trying to change our build scripts from using SourceSafe to TFS without using MsBuild (yet).
One hiccup is that the workspace directory is renamed and archived by the scripts, which makes TFS think it doesn’t need to get any files. Even with the /force flag it just gets the directories without getting the source files.
I am currently using
TF.exe get “Product/Main/Project1”  /force /recursive /noprompt
To save me managing workspaces in the scripts or using intermediate directories, does anyone know of a command that can get directories and code without needing a workspace?

Ans: It’s not possible to run a tf get without a workspace. The reason is that the server needs to know the mapping between the server paths and the local paths.
If you are working with a large number of files, it is not a good idea to:
Create & Delete a new workspace every time
Or, create a new workspace (and then never delete it)
The reason for this is that every time you do a Get, the server keeps track of which files, at which versions were downloaded to which workspace. If you never clean up these workspaces, then the table that stores this information will grow over time.
Additionally, if you are creating & deleting a workspace all the time, the server has to write all these rows, then delete them when you are done. This is unnecessary.
You really should try and reuse the same workspace each time. If you do, the server is very efficient about only sending you files that have changed since you last downloaded them. Even if your build is moving from one branch to another, you can use tf get /remap which is sometimes more efficient if the branches share common files.
Although it doesn’t solve your problem, it is possible to list files and download files without a workspace.

To list files:

tf dir $/Product/Main/Project1 /R

To download a file:

tf view $/Product/Main/Project1/file.cs

With a creative batch file, you can string these two together with a FOR command. However, I would recommend trying to solve your workspace problem first, since that is the way that TFS was intended to be used.

Q72. Why and when to have multiple build agents?

Ans: Consider TFS 2010’s ability for a Build Controller to have 1+ build agents. Since builds are a subjective topic to the team/environment, consider an environment where builds are performed on commit/check-in. Each Project Collection will have 10+ Team Projects, but perhaps only 1 or 2 are being committed to in a day.
1. When should a TFS administrator consider creating a new build agent?
2. Do multiple agents run in parallel?
3. When a single agent is defined as a Build Controller, does it run serially?
4. MSDN STATES: “IF YOU SET UP YOUR AGENTS TO HAVE SPECIALIZED CAPABILITIES…”. What does this mean? A technology/platform differentiator? How can you setup your agents to have specialized capabilities?
How can ‘tagging’ build agents be used effectively in an environment where builds are (typically) performed on each check-in.

You use multiple build agents to support multiple build machines (I work currently with a build farm with 3 build machines – and thus 3 build agents – to distribute the load).
You also might want to have multiple build agents to be able to run builds in parallel. This is a nice feature to share resources, but a requirement when you start working with Test/Lab Management features.

With the capabilities: for example, you can set up a build agent with version 1 of a 3rd party component, and a second build agent with version 2. With tagging you can specify in the build definition which build agent it will choose from out of the pool of build agents.

Q73. Team Foundation Server: Assign work item to a group instead of an individual user

In TFS 2010, is there a way that I can assign a work item to a group (i.e. Developers or Designers) instead of an individual user? I’d also want to be able to create a query so that we can filter on that group as well.

Ans: Yes, you can. If your group is a member of the larger group that can be assigned to, then it will appear in the list of assignable users.
For example, a user hierarchy might be like this:
[Assignable Users]
[Project Managers]
Mark Avenius
Joe Schmoe
EDIT As for the query, you can have the clause Assigned To contains @Me, which I believe will do what you want.

Q74. How can this be achieved with Team Build 2010?

Ans: This blog post should help you out:

Essentially, you create a new ‘Platform’ for each project. Team Build will put each platform in a different directory by default, so you get a different directory for each of your projects.
Build configuration dialogue:

items to build

Q75. Multiple copies of a solution on one user/machine with TFS 2010

Ans: Is there a way to pull two copies of a single solution from TFS 2010 for the same user/machine?
 You can have multiple copies of a single solution either by having multiple branches in TFS or by setting up different workspaces.
The branches are good for when you need to be able to check-in code for both copies of the solution and have other people work with it too.
I use multiple workspaces when I need to have a last good state of the code on my dev box while at the same time and still working on new features.

Explore TFS Sample Resumes! Download & Edit, Get Noticed by Top Employers!

List of Related Microsoft Certification Courses:

 SSIS Power BI
 SSRS SQL Server
 SCCM BizTalk Server
 SharePoint BizTalk Server Administrator


Course Schedule
TFS TrainingJul 23 to Aug 07View Details
TFS TrainingJul 27 to Aug 11View Details
TFS TrainingJul 30 to Aug 14View Details
TFS TrainingAug 03 to Aug 18View Details
Last updated: 12 Jul 2024
About Author

Ravindra Savaram is a Technical Lead at His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.

read less