我不确定我要做的是正确的,所以我首先告诉你我的问题.我有TFS作为Bugtracking系统和另一个跟踪工作时间的系统.我希望如果工作项状态发生变化,其他系统也会更改状态.
我到现在所做的是以下内容.
我为TFS Web服务写了一个插件,我抓住了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)
{
WorkItemChangedEvent ev = notificationEventArgs as WorkItemChangedEvent;
EventLog.WriteEntry("WorkItemChangedEventHandler", "WorkItem " + ev.WorkItemTitle + " was modified");
}
}
catch (Exception)
{
}
return EventNotificationStatus.ActionPermitted;
}
Run Code Online (Sandbox Code Playgroud)
我在C:\ Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services\bin\Plugins中删除了DLL,但我看起来从未调用过扩展名.所以事件日志中没有任何内容.
但是,如果我尝试调试服务,请参阅此文章http://geekswithblogs.net/jakob/archive/2010/10/27/devleoping-and-debugging-server-side-event-handlers-in-tfs-2010. aspx 我不能挂钩这个过程.所以调试不起作用.为什么我不能调试服务?还有更好的方法吗?
小智 5
不确定你是否解决了这个问题,但对我而言,你似乎错过了类中的Subscription方法.
public Type[] SubscribedTypes()
{
return new Type[1] {typeof(WorkItemChangedEvent)};
}
Run Code Online (Sandbox Code Playgroud)
如果没有这个,你的插件将永远不会受到影响,因此你将无法进行调试.