40
votes

We're using team foundation server for our source control. I frequently put files into my project (under source control) and forget to "add" them as far as TFS is concerned. There are also cases where TFS doesn't pick up new files (copy and paste a file in your project).

Is there a way I can list all of the files that have not been marked as "add" so that I can verify that all of the intended check-ins take place?

This is driving me crazy! We don't have continuous integration set up yet for this project, and I keep missing files. I don't find out until someone asks me where the file in.

In Subversion, this was dead simple.

I know one solution is to checkout a second copy, but that's not really an optimal workaround.

9
NINE YEARS later and this is a bigger problem than ever for me :-( - Simon_Weaver

9 Answers

68
votes

Go to Source Control Explorer, right click on the folder you are interested in and choose compare.

This will show both files that are not added and also files that have been modified without checking out first.

This solution does not require Power Tools

17
votes

You might want to make sure you have the latest version of the TFS client installed (VS 2008 SP1) as that makes it much easier to work with files. Also, take a look at the TFS Power Tools - especially the tfpt online command.

The tfpt command line has a bunch of handy TFS utilities. Once you install the TFS power tools, type "tfpt help" at a Visual Studio 2008 Command Prompt to get a list. If you do "tfpt online /r" in the root of your solution it will detect the files that are writeable in your local file system and pend adds or edits for them. You might want to limit the command so that it only looks for source files - "tfpt online /r *.cs" for example.

12
votes

Yes there is. Navigate to Source Control Explorer. Click on the project you're interested in. Click the "Add Items to Folder" button. It is two over from the refresh button. This will give you a list of all files that are in the folder but not added to source control.

4
votes

In VS 2015 this helped me to add file to the Version Control

  1. Open "Add Items to Folder..." Context menu item in Source Control Explorer

  2. Add necessary files

screenshot

3
votes

'Inspired' by this answer

The TFS Power Tools ) now have Windows Shell Extensions, so you manipulate source control files using only Windows Explorer.

The option you're after is Compare with workspace version - this works recursively too, and allows one to selectively add/delete, etc. (yes, tf.exe will probably have an equivalent)

alt text
(source: msdn.com)

alt text
(source: msdn.com)

1
votes

If you're using Visual Studio, you can right-click a folder in the Solution Explorer and choose Add > Existing item. Unfortunately, the resulting "add file dialog" doesn't automatically scope to the folder you clicked.

However, there is also a button in Solution Explorer called "Show all files". After clicking this, files not included in the project will appear and get an "include in project" context menu item. Including them will usually put them in TFS's "Pending changes" list as "added" automatically.

enter image description here

(Source.)

1
votes

Migrate to git, like Microsoft is doing :)

0
votes

For Visual Studio 2017, this is still a problem, but easily repaired: Navigate to : SOLUTION EXPLORER second button to right of REFRESH circular arrow is: SHOW ALL FILES Click that

All your files will appear faded out, but visible. Right click on each one and select "INCLUDE in PROJECT"

when your all done, snail Mail a letter of complaint to Microsoft

0
votes

If I understand your question correctly, the following Powershell script would spit out the files that are not yet added:

[hashtable] $lps = [hashtable]::new()

tf info . -recursive | findstr /r /c:"^  Local path :" | foreach-object {
    $lp = $_ -replace '^  Local path : ', ''
    if ($lp) {
        $lps[$lp.toLower()] = $null
    }
}

get-childItem -recurse | foreach-object {
    if (-not $lps.ContainsKey($_.fullName.toLower())) {
       (resolve-path -relative $_.fullName).toString()
    }
}