TFS WorkItemChangedEvent触发两次

Fer*_*roc 1 c# events tfs2012

我有一个使用的TFS2012插件

public EventNotificationStatus ProcessEvent()

获取WorkItemChangedEvent.它没有做太多,只是将WorkItemChangedEvent添加到消息队列中,以便稍后我可以使用不同的服务来获取它.

由于某种原因,事件总是为我更改的每个工作项触发两次,并将事件两次添加到我的队列中.

知道为什么吗?

我使用的代码:

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

        try
        {
            if (notificationType == NotificationType.Notification && notificationEventArgs is WorkItemChangedEvent)
            {
                var ev = notificationEventArgs as WorkItemChangedEvent;
                const string queueName = ".\\private$\\tfs";
                var msgQueue = new MessageQueue(queueName);
                var msg = new Message(ev);
                msgQueue.Send(msg, MessageQueueTransactionType.Single);
                Log.Debug(string.Format("Added event for work item #{0} to queue", ev.WorkItemTitle));
            }
        }
        catch (Exception ex)
        {
            Log.Fatal("Error", ex);
            return EventNotificationStatus.ActionDenied;
        }

        return EventNotificationStatus.ActionPermitted;
    }
Run Code Online (Sandbox Code Playgroud)

Fer*_*roc 6

(一如既往,在我提出问题后几分钟,我得到了正确的想法)

今天我了解到:插件目录中的子文件夹不足以禁用插件.我在"旧"文件夹中备份了我的旧自动化,但它仍然加载了它.