开发者

How to return the version (changeset) of a file in a workspace using the TFS object model?

开发者 https://www.devze.com 2023-01-05 02:53 出处:网络
How can the version (changeset) of a file in a workspace be re开发者_开发技巧turned using the TFS object model?I want to be able to pass in the path of a file in my workspace and have the changeset re

How can the version (changeset) of a file in a workspace be re开发者_开发技巧turned using the TFS object model? I want to be able to pass in the path of a file in my workspace and have the changeset returned.


Here's the general approach:

var versionControl = projectCollection.GetService<VersionControlServer>();

var item =
    versionControl.GetItem(
        "$/TeamProject/Main/Solution/Program.cs",
        new WorkspaceVersionSpec("workspace", "user"));

int changesetId = item.ChangesetId;

The key is the WorkspaceVersionSpec object.

0

精彩评论

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