Find unadded files in Team Foundation Server

Viewed 22713

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 Answers

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

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.

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.

'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)

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

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()
    }
}
Related