【问题标题】:How to load Checkin Policy in custom TFS-Plugin如何在自定义 TFS 插件中加载签入策略
【发布时间】:2011-10-04 07:52:21
【问题描述】:

我为使用Microsoft.TeamFoundation.*-Namespaces 将TFS-VCS 集成添加到该程序的程序创建了一个插件。

基本上可以,但现在我遇到了自定义签入政策的问题:
我们为该项目激活了 2 个签入策略:来自 TFS Power Tools 的 ChangesetCommentPolicy 和一个由我们创建的自定义策略。 两者都在 Visual Studio 和 Shell 集成中工作,但在我的插件中出现以下错误:

变更集评论政策中的内部错误。加载错误 变更集评论政策政策。安装说明:到 安装此策略,请按照 CheckForComments.cs 中的说明进行操作。

对于我们的自定义策略也是如此,只是使用其他策略名称。

这里有一个代码 sn-p 我如何获得政策警告:

//CurrentWorkspace is Microsoft.TeamFoundation.VersionControl.Client.Workspace
CheckinEvaluationResult result = Manager.CurrentWorkspace.EvaluateCheckin(CheckinEvaluationOptions.Policies,
    PendingChanges.ToArray(), changes.ToArray(), textBoxComment.Text, GetCurrentCheckinNotes(), GetSelectedWorkItems());
if (result.PolicyEvaluationException != null || result.PolicyFailures.Length > 0)
{
    labelPolicyWarning.Text = "The following check-in policies have not been satisfied";
    pictureBoxWarning.Visible = true;

    foreach (PolicyFailure failure in result.PolicyFailures)
    {
        items.Add(failure);
    }
    if (result.PolicyEvaluationException != null)
        items.Add(result.PolicyEvaluationException);

    objectListViewPolicyWarnings.SetObjects(items);
}
else
{
    labelPolicyWarning.Text = "All check-in policies are satisfied";
    pictureBoxWarning.Visible = false;
}

如何在我的插件中“加载”政策以便执行?

P.S.:插件适用的程序是 FlashDevelop,如果这很重要的话。

【问题讨论】:

    标签: c# tfs checkin-policy


    【解决方案1】:

    在我的程序中调用 tfs checkin 时收到相同的错误消息。搜索了一会儿,似乎错误消息来自团队资源管理器,安装 TFS power tools 2010 后,此消息不再显示。

    【讨论】:

    • 您使用的是哪个版本的 Team explorer,TFS Power Tools 2010 仅适用于 Team explorer 2010。TFS Power Tools 2005/2008 也存在。
    【解决方案2】:

    目前似乎不支持此功能,因为即使 MS 也没有解决方案: http://social.msdn.microsoft.com/Forums/pl-PL/tfsgeneral/thread/344b1846-d571-4d17-842b-70fc05f5a83a

    【讨论】:

      猜你喜欢
      • 2020-01-20
      • 1970-01-01
      • 2011-09-02
      • 2013-01-12
      • 1970-01-01
      • 2013-11-07
      • 1970-01-01
      • 2017-08-12
      • 2017-11-23
      相关资源
      最近更新 更多