1 / 28

Visual Studio Team System

Visual Studio Team System. Extending the Visual Studio Team System. Agenda:. TFS Event Subscription Custom Check-in Policies. TFS Event Subscription. VSTS fires Events when various things happen Can subscribe to these events There are Two Subscription Models E-mail (Plain Text or HTML)

jirair
Download Presentation

Visual Studio Team System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visual Studio Team System Extending the Visual Studio Team System

  2. Agenda: TFS Event Subscription Custom Check-in Policies

  3. TFS Event Subscription • VSTS fires Events when various things happen • Can subscribe to these events • There are Two Subscription Models • E-mail (Plain Text or HTML) • Web Services

  4. Event Types There are several Event types • BUT, they are not well documented • EventType is defined by a schema • Schema’s are located in the TFS installation folder • C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Services\v1.0\Transforms • SOME Schema’s are definied in the database • In the TfsIntegration database, there is a table called tbl_event_type • USE TfsIntegration SELECT [name], [event_type_schema] FROM tbl_event_type

  5. Available Event Types RED– available through Team Explorer – Project Alerts

  6. Subscribing to Events • Certain Events are available through the Team Explorer • Right click on a selected project in the team explorer then click on Project Alerts

  7. Demo Team Explorer Project Alerts

  8. Subscribing to Events • Can subscribe to events using the command line tool on the server • C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\TF Setup\BisSubscribe.exe

  9. E-mail Subscription (BisSubscribe) • Run BisSubscribe.exe specifying: • The EventType • The E-mail Type (Plain Text or HTML) • Recipient (address to send the mail to) • Filter expression BisSubscribe.exe /eventType CheckinEvent /address christian@commentor.dk /deliveryType EmailHtml /server MAGNI /filter ”TeamProject=’Commentor Framework’”

  10. Web Service Subscription • Run BisSubscribe.exe specifying: • The EventType • deliveryType as Soap • Web Service URL • Filter expression BisSubscribe.exe /eventType CheckinEvent /address http://christian/Service.asmx /deliveryType Soap /server MAGNI /filter ”TeamProject=’Commentor Framework’”

  11. Web Service Definition • Must have a specific shape • XML passed in is definied by a schema • public void Notify(string, string);

  12. Listing your Subscriptions • There is no direct way to list what subscriptions currently exist in the TFS • To view a list of subscriptions, one must query directly to the database

  13. Programmatic Event Subscription • Visual Studio Industry Partner SDK • Customize, Extend... Create! • Programmatically Subscribe or UnSubscribe to TFS events • IEventService (Microsoft.TeamFoundation.Server) • Provides support for event subscription

  14. IEventService • SubscribeEvent() • User ID (string) • Event Type (string) • Filter Expression (string) • DeliveryPreference() • Address – Email address or Web Service URL • Schedule – Daily, Weekly, Immediately • Type – EmailHtml, EmailPlaintext, or Soap (Web Services) • Classification (string) • Tag or Name to for the event

  15. Programmatic Event Subscription • Add a reference to • Microsoft.TeamFoundation • Microsoft.TeamFoundation.Client

  16. Cancelling Subscription • UnSubscribeEvent() • Subscription ID (int)

  17. Demo Email Subscription via C# Web Service Subscription via C# Web Service Sample

  18. Custom Check-in Policy • Visual Studio Team System object model • Not fully documented • Part of the VSIP SDK

  19. Creating Check-in Policies • Fully customizable • Enforce company coding standards • Disallow tabs • Code documentation standards • Etc.

  20. Creating a Check-in Policy • Create a new Class Library project • Add the [Serializable] attribute to the class • Add a reference to Microsoft.TeamFoundation.VersionControl.Client.dll • Make the class implement the following: • IPolicyDefinition • IPolicyEvaluation

  21. IPolicyDefinition • Determines how the check-in policy is displayed to the user

  22. IPolicyEvaluation • During the actual Check-in • Calls Initialize() then Evaluate()

  23. Evaluating the Check-in • Initialize() is passed reference to IPendingCheckin • This gives access to any pending changes • Evaluate() returns an array of PolicyFailure objects

  24. CheckedPendingChangesChanged • IPolicyEvaluate has PolicyStateChanged event definied on the interface • Visual Studio subscribes to this event • Policy can subscribe to CheckedPendingChangesChanged event in Initialize() • Subscribe to CheckedPendingChangesChanged event in Initialize() • VSTS fires CheckedPendingChangesChanged event to signal change of files being checked in • When files [de]selected in the Pending Check-ins Window • Respond to CheckedPendingChangesChanged event by: • Re-evaluating the Policy • Firing PolicyStateChanged event • Pass list of Policy Failures

  25. CheckedPendingChangesChanged

  26. Deplying Check-in Policies • Add registry entry on the server and clients • Assembly must be copied to: • Team Foundation Server machine • User workstations

  27. Policy Error • Policy must be installed properly both on the server and client • Error dialog is shown otherwise

  28. Demo No Tabs Custom Policy

More Related