【问题标题】:TFS 2013 - WorkItemChangedEvent not being raised - Configuration?TFS 2013 - WorkItemChangedEvent 未引发 - 配置?
【发布时间】:2014-09-13 07:27:39
【问题描述】:

我们有一个自定义 TFS 插件(用 C# 编写),用于订阅工作项更改。
我们正在升级到 TFS 2013,因此我们正在升级插件。
不幸的是,该插件不响应 WorkItemChangedEvents。相同的插件在 TFS2012 中响应了这些,没有任何问题。
TFS 配置中是否有一个标志来禁用我们可能设置的这些事件?该插件会选择其他事件类型,所以我不确定插件是否是问题所在。
我一直在使用一个非常简单的插件来测试引发了哪些事件。其 C# 代码如下:

using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.Framework.Server;
using Microsoft.TeamFoundation.Server.Core;
using Microsoft.TeamFoundation.WorkItemTracking.Server;
using System;
using System.Configuration;
using System.Diagnostics;

namespace TestSubscriber
{
    class TestSubscriber : ISubscriber
    {
        #region ISubscriber Members

        public string Name
        {
            get { return "TestSubscriber"; }
        }

        public SubscriberPriority Priority
        {
            get { return SubscriberPriority.Normal; }
        }

        public Type[] SubscribedTypes()
        {
            return new Type[3] { typeof(WorkItemsChangedNotification), typeof(WorkItemChangedEvent), typeof(SendEmailNotification) };
        }

        public EventNotificationStatus ProcessEvent(TeamFoundationRequestContext requestContext,
            NotificationType notificationType, object notificationEventArgs, out int statusCode,
            out string statusMessage, out ExceptionPropertyCollection properties)
        {
            statusCode = 0;
            statusMessage = string.Empty;
            properties = null;

            if (notificationEventArgs is WorkItemsChangedNotification)
            {
                TeamFoundationEventLogger.Log("Received WorkItemsChangedNotification", 0, EventLogEntryType.Information);
            }
            else if (notificationEventArgs is WorkItemChangedEvent)
            {
                TeamFoundationEventLogger.Log("Received WorkItemChangedEvent", 0, EventLogEntryType.Information);
            }
            else if (notificationEventArgs is SendEmailNotification)
            {
                TeamFoundationEventLogger.Log("Received SendEmailNotification", 0, EventLogEntryType.Information);
            }

            return EventNotificationStatus.ActionPermitted;
        }

        #endregion
    }
}

以下是 Visual Studio 项目的参考列表:

  • Microsoft.TeamFoundation.Common
  • Microsoft.TeamFoundation.Framework.Server
  • Microsoft.TeamFoundation.Server.Core
  • Microsoft.TeamFoundation.WorkItemTracking.Server
  • Microsoft.VisualStudio.Services.WebApi
  • 系统
  • System.Core

如果我对触发电子邮件的工作项进行更改(我将工作项分配给自己),订阅者会收到 SendEmailNotification,但不会收到 WorkItemChangedEvent。如果我做出的更改不会发送电子邮件(另一个工作项的状态更改),订阅者不会收到通知。

如果有人对我做错了什么有任何建议,请告诉我。一段时间以来,我一直在为此挠头。 谢谢。

【问题讨论】:

    标签: c# plugins tfs


    【解决方案1】:

    尝试:

    public EventNotificationStatus ProcessEvent(TeamFoundationRequestContext requestContext, NotificationType notificationType, object notificationEventArgs, out int statusCode, out string statusMessage, out ExceptionPropertyCollection properties)
            {
                if (notificationType == NotificationType.Notification && notificationEventArgs is WorkItemChangedEvent)
                    {
    

    【讨论】:

      【解决方案2】:

      感谢您的回复。原来我所做的是将我的插件部署在错误的位置。当它本应在 Web 服务/插件下时,我将它放在 Job Agent/Plugins 下。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-03-23
        • 1970-01-01
        • 2015-05-22
        • 1970-01-01
        相关资源
        最近更新 更多