4

Up to TFS 2017 there was a library in Plugins folder called Microsoft.TeamFoundation.Framework.Server it contained ISubscriber interface which one could override in order to attach hooks and add behavior for events such as build completed or new push to the git repository. The library is missing in TFS 2018. Does anyone know how do we maintain our plugins now?

riQQ
  • 9,878
  • 7
  • 49
  • 66
Paweł Zarzycki
  • 306
  • 3
  • 7
  • 2
    I don't have a good answer for you without doing some R&D, but I'd strongly recommend transitioning off of the server-side plugin model and toward using service hooks/REST APIs for scenarios like this. Service hooks and REST APIs are clearly the best-supported and preferred way of interacting with TFS. – Daniel Mann Mar 23 '18 at 16:24
  • Do service hooks allow to abort a Pull Request, for example? – mark Oct 04 '18 at 01:35
  • @mark Not directly like you would with a server side plugin, you’d probably want to use a service that engages in the PR workflow through the Status API https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=vsts#require-approval-from-external-services – Pero P. Oct 14 '18 at 15:14

1 Answers1

2

The library is still there, just under the TFS 2018 install directory. If you’re deploying your plugins into TFS 2018 you will need to recompile them against the 2018 references.

We have several plugins subscribing to WorkItemChangedEvent, Git PushNotification event and BuildDefinitionChangingEvent and they all work up to and including TFS 2018 Update 3.

Pero P.
  • 25,813
  • 9
  • 61
  • 85
  • Do these events allow to abort the respective operation? Or are they notification only? – mark Oct 15 '18 at 00:16
  • They allow you to block the operation. We block Git Push requests if they don’t satisfy certain criteria. We use this plugin: https://github.com/giuliov/GitPushFilterPlugin/blob/master/GitPushFilterEventSubscriber.cs – Pero P. Oct 15 '18 at 06:11
  • Do you mind answering https://stackoverflow.com/questions/52636146/is-it-possible-to-prevent-pull-requests-from-a-certain-branch-in-tfs? I would like to credit you. – mark Oct 15 '18 at 15:06
  • You sir, are a true hero. It will take quite a bit more finagling with getting things setup right, but this will solve my problem. The libraries are pretty poorly documented, however you can do a remote debug against the IIS app pool and debug in to the plugin to be able to poke around and find what you need relatively easily if you have a solid understanding of Git in general. – AJ Henderson Nov 08 '18 at 20:45