How to programmatically detect deleted files?

2019-08-28 00:24发布

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?

2条回答
甜甜的少女心
2楼-- · 2019-08-28 00:48

The VersionControlServer.QueryHistory API will give you access to the changesets which will contain all version control operations including deletes.

查看更多
姐就是有狂的资本
3楼-- · 2019-08-28 00:57

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.

查看更多
登录 后发表回答