开发者

In TFS, How do i check if a file is latest or not using C# code?

How do i check if all the files in a folder are latest or not. I need to put up a condition in C# code which should get latest version of the project only if there is any file in the project folder having the latest as "No"?

Any 开发者_运维百科help wpould be greatly appreciated.


There's a few ways that you could do this programmatically, but the easiest way is to let the server determine this for you: if you perform a get latest with the preview get option set, it will not actually perform the get, it will simply tell you what would be retrieved to bring you up to the latest version.

For example:

GetStatus status = workspace.Get(new GetRequest(null, VersionSpec.Latest), GetOptions.Preview);

if(status.NumOperations == 0)
{
    /* All files up to date. */
}
else
{
    /* We are not up to date on some files. */
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜