How to have TFS 2010 detect changes done to files outside of Visual Studio?

Solution 1:

TFS has a "Reconcile" command for this:

  1. Open the Source Control Explorer
  2. Right-click on the folder with the changes and choose Compare
  3. Select the files you want to reconcile (press CTRL+A to select all files)
  4. Click on the Reconcile button
  5. Set the options in the Reconcile Folder Differences dialog. Make sure Files that do not have pending changes is set to Check Out
  6. Click OK
  7. If you have local changes the Check Out dialog will be shown. Set the preferred Lock type
  8. Click Check Out

Reconcile Folder Differences

See also: Reconcile differences between folders

Solution 2:

If you have a network connection to your server while you're working outside of Visual Studio, it's probably best to go ahead and check the file out before editing it, either using the tf command line client, or using the Windows Explorer shell integration that's available in the TFS Power Tools release. (Plus an increasing number of other tools have TFS integration that makes this automatic, but if you're just using notepad, this still needs to be a manual step.)

Of course, there are many times when you're working and you don't have a network connection available that allows you to check out the files.

If you know what files you've modified, you can just check them out from within Visual Studio, then you'll be able to check them back in.

If you don't know what files you've edited, you can detect the changes by running the tfpt online command (also part of the Power Tools release). This will locate the files that have been modified locally and check these files out from the server.

Solution 3:

This worked for me, using the TFS Power Tools:

tfpt online /adds /deletes /diff /noprompt /recursive directory-name

(where directory-name is the path to the directory to be updated, otherwise it will detect changes throughout your entire TFS repository)

If you want to know what it would do without it actually making any changes, you can force it to do a dry run by adding the /preview switch.