问题
In Team Foundation, you can ask Team Explorer to show deleted files by doing this:
Tools > Options > Source Control > Visual Team Foundation Server > Show deleted items in the Source Control Explorer.
My question is how do you do the same thing programmatically?
I am developing a synchronisation tool, and I need to detected deleted files in TFS. Workspace.Get(...) returns only non-deleted files.
Any idea how I can achieve that?
回答1:
Go to the Visual Studio folder in your start menu and start up a Visual Studio Command Prompt from the "Visual Studio Tools" subfolder.
The command you want to run is:
tf dir /server:myserver $/myproject /recursive /deleted
(where myserver and myproject are your server and project)
use "tf help" for general info, "tfs help dir" for more help on this command, or google on "tf.exe" for more info.
回答2:
The VersionControlServer.QueryHistory API will give you access to the changesets which will contain all version control operations including deletes.
来源:https://stackoverflow.com/questions/917406/how-to-programmatically-detect-deleted-files