Important : Do not forget to install system prerequisites for development.

  1. Open Visual Studio 2012
  2. Create a class project
  3. Add a reference on these assemblies
    - SearchForWorkitemsChanges.ExternalActions
    - Microsoft.TeamFoundation.WorkItemTracking.Client - version 11 (2012)
    - Microsoft.TeamFoundation.WorkItemTracking.Common - version 11 (2012)
  4. Create a class that implements interface SearchForWorkitemsChanges.ExternalActions.IExternalAction
    Example for a Hello World addon :
    internal class HelloWorldAddOn : IExternalAction
    {
        /// <summary>
        /// Name displayed on the button
        /// </summary>
        public string DisplayName
        {
            get { return "Hello World !"; }
        }
    
        /// <summary>
        /// ToolTip displayed on the button
        /// </summary>
        public string TooltipDescription
        {
            get { return "Test addon Hello world !"; }
        }
    
        /// <summary>
        /// Execute called on button click
        /// </summary>
        /// <param name="workitems">The search result</param>
        public void Execute(IEnumerable<Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem> workitems)
        {
            MessageBox.Show("Hello World !");
        }
    }
    
     
  5. Build your project, copy the output build into the application's path
  6. Open application configuration file
  7. Add an entry in the types section of the unity container named ExternalActions
    All entries in this section must have a unique name, so choose a good one !

    Syntax of the type entry :
    <type name="UniqueName"  type="SearchForWorkitemsChanges.ExternalActions.IExternalAction, SearchForWorkitemsChangesComplement" mapTo="YourCustomNameSpace.YourCustomClassName, YourAssemblyName" ></type>
    
      > Replace UniqueName with your choosen one (as you want)
      > Replace YourCustomNameSpace with the full namespace of your
            IExternalAction implementation class
      > Replace YourCustomClassName with the name of your 
            IExternalAction implementation class
      > Replace YourAssemblyName with the name of your assembly containing the 
            IExternalAction implementation class

    Final Result for the sample above :
    <unity>
      <container name="ExternalActions">
        <types>
          
          <type name="ActExportXml"  type="SearchForWorkitemsChanges.ExternalActions.IExternalAction, SearchForWorkitemsChangesComplement" mapTo="SearchForWorkitemsChanges.ExternalActions.ExportXml, SearchForWorkitemsChangesComplement" ></type>
          <type name="ActExportReport"  type="SearchForWorkitemsChanges.ExternalActions.IExternalAction, SearchForWorkitemsChangesComplement" mapTo="SearchForWorkitemsChanges.ExternalActions.ExportRdlc, SearchForWorkitemsChangesComplement" ></type>
    
          <!-- New entry for Hello World contained in SearchForWorkitemsChangesComplement assembly -->
          <type name="HelloWorld"  type="SearchForWorkitemsChanges.ExternalActions.IExternalAction, SearchForWorkitemsChangesComplement" mapTo="SearchForWorkitemsChanges.ExternalActions.HelloWorldAddOn, SearchForWorkitemsChangesComplement" ></type>
    		
        </types>
      </container>
    </unity>
    


  8.  Save the configuration file
  9. Restart application

If no addon's button is displaying check your configuration file !

Last edited Jul 11, 2013 at 11:09 AM by benji_dv, version 4

Comments

No comments yet.