【问题标题】:How do i get the 'branch' icon to display in TFS 2013 Source Control when using the TFS API?使用 TFS API 时,如何在 TFS 2013 源代码控制中显示“分支”图标?
【发布时间】:2013-12-16 06:14:33
【问题描述】:

在尝试使用 TFS 2013 API 时,我遇到了以下问题,在以编程方式创建这样的新分支时似乎无法解决:

//var workspace = connect-to-tfs-server-and-locate-workspace

workspace.PendBranch(scmSourcePath, scmTargetPath, VersionSpec.Latest);
changes = workspace.GetPendingChanges();
workspace.CheckIn(changes, "I just create a branch");

甚至通过,

workspace.CreateBranch(scmSourcePath, scmTargetPath);

分支创建得很好,但是此处显示的新图标 http://msdn.microsoft.com/en-us/library/ms181425.aspx 未显示(请注意 FeatureTeamA 图像中的替代图标)。而是显示“无信息”文件夹图标。

如果我使用源代码管理资源管理器创建相同的分支,它会显示新的“分支图标”。有人知道我缺少什么吗?

【问题讨论】:

    标签: branch tfs-sdk


    【解决方案1】:

    您需要将父文件夹转换为BrancObject(如果它还不是一个):

    // The source of the branch must first be created as a branch object 
    VersionControl.CreateBranchObject(new BranchProperties(new ItemIdentifier(sourceServerPath)));
    
    // Then you can create the branch 
    VersionControl.CreateBranch(sourceServerPath, targetServerPath, VersionSpec.Latest, null, checkinComment, null, null, null);
    

    另见:

    【讨论】:

    • 嗯,这根本不明显。非常感谢:)
    猜你喜欢
    • 2013-09-17
    • 1970-01-01
    • 2014-12-06
    • 1970-01-01
    • 1970-01-01
    • 2012-01-20
    • 2012-04-04
    • 2011-04-07
    • 2016-04-09
    相关资源
    最近更新 更多