Book Image

Team Foundation Server 2015 Customization

By : Gordon Beeming
Book Image

Team Foundation Server 2015 Customization

By: Gordon Beeming

Overview of this book

Table of Contents (17 chapters)
Team Foundation Server 2015 Customization
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The basics of server plugin code


The first thing that we need to do for a server plugin is make our class, which in this case is BigChangesServerplugin, inherited from Microsoft.TeamFoundation.Framework.Server.ISubscriber. Next, we need to implement the properties and methods required by the interface. The first thing here is the following code:

public string Name => 
      "Big Changes Server Plugin";
public SubscriberPriority Priority => 
      SubscriberPriority.Normal;
public Type[] SubscribedTypes() => 
      new Type[] { typeof(CheckinNotification) };

This code gives our plugin a name and the execution priority and lists what types we want to be notified on events for. We don't require any specific priority, so leaving it as Normal is okay, and then the event types we want to execute on is CheckinNotification. Also add a new using function for:

using Microsoft.TeamFoundation.Framework.Server;
using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.VersionControl...