Naren's Blog

  • Powertool to easily create notification alerts for workitems, source control and build items

    Last piece of powertool I worked on before leaving TFS is the integrated tool to easily create notification alerts for WorkItem tracking, source control and build items. It is released and part of power tools now. Checkout screen shots and download the tool by visiting Brian's blog at: http://blogs.msdn.com/bharry/archive/2008/07/08/july-08-tfs-power-tool-preview.aspx . Creating notifications was one of biggest painpoints for customers and I am excited that this tool will solve most needs that can be accomplished with server limitations today. This should replace various similar tools available in web that does subset of these functionalities.

  • When you have questions on WIT Extensibility or on my blog posts...

    This week I am moving over to new team in Microsoft. I love workitemtracking and TFS, but I need to move out of country for family reasons and hence had to leave TFS. So I am not expecting to write anymore posts on TFS. I *might* start writing more on new areas I am going to work on though.

    I still keep getting questions from various readers on WorkItemTracking and TFS. If you have question, please post your question to WIT forum at: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=479&SiteID=1, someone in TFS team will answer your question. If you are not getting responses, you can try posting me question from link in this blog and I'll try to forward to right person. If it is really pressing and urgent question, contact CSS from support.microsoft.com (or 800/936-5800 if from US).

  • Link Queries: How to use object model to build & run link queries in Rosario?

    Many asked me how linking is exposed in our Rosario object model, how to construct, run and use the results of link queries. I decided to build a power point on explaining it and attached is that powerpoint file: http://blogs.msdn.com/narend/attachment/7701866.ashx
  • Building custom controls in Team System Web Access

    Team System Web Access 2008 powertool is released with TFS 2008 recently on Nov 19th (see here for WIT improvements in this release). So I expect more people will start looking into porting their custom controls over to Web Access or building new ones in Web Access. Few asked me how to building custom controls for web access, and here is how from Hakan who owns TSWA:

    Our SDK is shipped along with Team System Web Access itself, so you will have it when you install TSWA.

    You can download our CTP release at:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=8d3f8eec-301a-4e96-adc5-abf47f462654&DisplayLang=en

    Once you install it, look under the installation directory – you’ll see an “SDK” directory with the documentation and samples for WIT custom controls.

    Custom controls built for VS winforms cannot be used as-is in web access because of technology differences, but it is as easy to build new ones for Web Access. Check out the SDK.

  • New powertools released with work item templates feature

    Many customers have asked for templates functionality in work item to easily create workitems. Also, there is strong need to apply changes to many work items in a shot without having to export to excel. You can do all that with templates feature in Sept release of powertools now. See Gregg's post for indepth details on this feature & screenshots: http://blogs.msdn.com/teams_wit_tools/archive/2007/09/29/tfs-power-tools-release-work-item-templates-introduction.aspx.  Also see Brain's post here: http://blogs.msdn.com/bharry/archive/2007/09/29/september-tfs-power-tools-released.aspx. Bulk apply is the feature I use much and is a great addition. Download it soon from here

  • Working with Rosario workitem links in object model

    As you know, Rosario comes up with rich linking abilities for workitems and object model to support it. Working with object model could be a bit tricky when it comes to comprehending directions of links and Durgaprasad wrote a nice blog on how to use the OM. Check it out here: http://blogs.msdn.com/dgorti/archive/2007/09/26/querying-on-workitem-links-through-the-api.aspx . Note that the actual querying for links based on criteria can be done with WIQL language.

  • Multivalue control is now available for download in codeplex

    Many customers have asked for a control to select multiple values for a field, or to tag work item with various tag strings & to be able to query on them. We might have such control built-in in future releases, but until then this can be solved with a custom control. We built such a custom control and posted it in codeplex project:  http://www.codeplex.com/WitCustomControls

    This uses a UI only solution for multivalue problem. We do not have any "multivalue" fields in our OM. See here for details on how it is implemented with just string field & how to query on its data: http://www.codeplex.com/WitCustomControls/Wiki/View.aspx?title=Multivalue%20control&referringTitle=Home

  • Adding custom menu items to "Team" menu

    Few customers wanted to add a menu to context menu of workitems in result list. It seems like a great idea to show actions on selected work items, but we haven’t exposed the command ids for context menus in V1 and Orcas. We did expose the “Team” menu in the main menu and it is easy to add commands under it using a VSIP package. Below is sample code for CTC file to add a menu group under “Team” menu.

     

      NEWGROUPS_BEGIN

        // NewGroup                              Parent Group                            Priority

        guidClientCustomizationsCmdSet:MyMenuGroup,    guidSHLMainMenu:IDM_MENU_TEAM_FOUNDATION_CLIENT,    0x0600;

      NEWGROUPS_END

     

    If you need these ids exposed, pls raise your suggestion at https://connect.microsoft.com/VisualStudio/feedback  with which menu groups you want to be exposed.

     

    Update 9/27/07: One of our customers, Kurt, took the ids from me and managed to add custom menus under context menus. Below is information on the lines he added to his VSIP files. This should help to add your own context menus (may be with some troubleshooting). once you have the menu added, you can get the workitem under context by using DocumentService described in http://blogs.msdn.com/narend/archive/2006/07/07/AccessingWitFromAddin.aspx
    Please note that this is not supported feature and the ids could change in future releases though I guess it would be unlikely.

     


     guidCustomReportingExtensionPackageCmdSet:MyMenuGroup,   guidSHLMainMenu:IDM_MENU_PROJECT_CONTEXT_MENU,      0x0600;  // Team Project context menu
      guidCustomReportingExtensionPackageCmdSet:MyMenuGroup,    CommandSetGuid:MENU_RESULTLIST,    0x0600;                 // Result List context menu
      guidCustomReportingExtensionPackageCmdSet:MyMenuGroup,   CommandSetGuid:MENU_WORKITEM,        0x0600;                 // Work Item document context menu


    // Command IDs rom the CommandIDs.h
    #define MENU_RESULTLIST        0x205
    #define MENU_WORKITEM          0x206

  • Defining custom actions for state transitions

    I heard this question few times: “I see the action named Microsoft.VSTS.Actions.Checkin to resolve work items in my tools, what other actions are available and how to use this feature to define my own”.

     

    What is a “custom action”? Suppose you are building a tool that will take shelveset from users and resolve workitems after running tests. Each work item type has its own set of states and rules and resolution means different for each work item type. So Resolve for task might be to move state to “Closed”, while for bug it is moving to “Resolved”. Custom actions defines this transition in work item type.

     

    Here is syntax from msdn link (it also has documentation on this) : http://msdn2.microsoft.com/en-us/library/ms194975(VS.80).aspx

     

    <TRANSITION from="Working" to="Ready To Build">

                    <ACTIONS>

                                    <ACTION value="Microsoft.VSTS.Actions.Checkin"/>

                                    <ACTION value="ADatum.Actions.Complete"/>

                    </ACTIONS>

    </TRANSITION>

     

    Let us take the example of resolving a bug again. We do it in the pending changes window (or checkin dialog) where work items can be associated with changesets before checking in, and upon checkin the work item will be resolved. Here is sample code piece that will do it:

     

                    string nextState = wi.GetNextState("Microsoft.VSTS.Actions.Checkin");

                    if (!String.IsNullOrEmpty(nextState))

                    {

                                    wi[CoreFieldReferenceNames.State] = nextState;

                                    wi.History = "Work item resolved by tool xxx for reason yyy associated with changeset ccc";

                    }

     

    This basically calls GetNextState of a work item and passes the action. Next state is returned if the action is valid and the next state is possible with given rules. You can programmatically move the work item to next state.

     

    This technique can be used in automated tools to work across various work item types in common way. This solves the problem for consistently handling state transitions and to check if a work item type can handle a specific action. We are thinking in the lines of extending this with features such as: ensuring a certain groups or categories of workitemtypes have specified set of fields, rules etc so that tools can handle groups of types consistently and automate wide range of functions.

  • How to port Whidbey custom controls to Orcas

    If you built a custom control in VS2005 (Whidbey) and deployed in user’s machines, what happens if the user upgrades to next version of TFS (Orcas or Rosario)? The Orcas client will try to load the custom control, but the custom control was compiled with VS2005 version of TFS dlls. Hence TFS will try to load those older version of TFS dlls and since they cannot be found they’ll fail with dll loading exception.

     

    So for custom controls to be loaded in Orcas client, the controls have to be recompiled with Orcas version of binaries and deployed to client machines. This is because of the dll dependencies. Inside Microsoft, we use bunch of custom controls and we have one installer for Whidbey and another for Orcas. It could be same custom control code but just compiled with right TFS dlls.

     

    What if customers have various versions of VS side-by-side? It is possible to have VS2005 and Orcas in same machine. For that purpose, we changed the search location of custom controls such that we’ll look at 9.0 folder under custom controls first and if we do not find required control then we’ll look at original location. So if you are building a setup for Orcas version of custom controls, install your controls under <custom control folder>\9.0 folder. Whidbey version of controls can continue to stay under original custom controls folder.

     

    This also enables taking advantage of new features of Orcas in your custom controls while giving older version for Whidbey users.

  • New links control features in Rosario

    Rosario is next release of TFS after upcoming Orcas release. You can read a lot about Rosario from Brian's blog. CTP is available to try these features. This post briefly lists UI featuers in links control.

    By default, the new links control now shows the links grouped by link type. See the screenshot above. The child links are grouped and each linktype group can be expanded/collapsed. Many customers asked "can I show state & assigned-to in links control?". Now admins can add any column to the links control. Also multiple linkscontrols can be added in a form with each control showing different linktypes. Each linkscontrol can be customized with specific link types, for example, one linkscontrol with parent/child links, another one with related and another with all other links. Check out Gregg's post here on how to filter the link types and how to give name for each control. His post does not give example for adding custom columns, see bolded lines below for adding custom columns.

    <Control Type="LinksControl" Name="UniqueName">

       <LinksControlOptions>

         <WorkItemLinkFilters FilterType="includeAll" />

         <ExternalLinkFilters FilterType="excludeAll" />

             <LinkColumns>

                <LinkColumn LinkAttribute="System.Links.Description" />

                <LinkColumn LinkAttribute="System.Links.Comment" />

                <LinkColumn LinkAttribute="System.Links.LinkType" />

                <LinkColumn RefName="System.AssignedTo" />

                <LinkColumn RefName="System.State" />

             </LinkColumns>

      </LinksControlOptions>

    </Control>

     

    Below is screenshot on querying for links and display for hierarchical link types.  

    For a tree query, the result list will have multiple levels displayed as trees.

  • New custom controls posted in codeplex project

    Two custom controls are posted now in WIT custom controls codeplex project: http://www.codeplex.com/WitCustomControls . Controls are: Screenshot control for easily getting & attaching screenshots and WebSiteControl where a website can be hosted inside work item form. Users could add some active content by hosting ASP.net forms in that website control. Thanks to Mathias Olausson for his help in getting these checked in and release made. It comes with a setup package.

    We know that MultiValueControl is much needed. We are thinking of releasing multivalue control in future powertools instead for broader reach and we are working on that control.

  • Nice trick to enforce certain rules on Area Path and Iteration Path

    I have heard this feature request so many times: Requiring at least N levels of nodes for Area Path and Iteration Path fields. Unfortunately we AreaPath and IterationPath can not take any rules and it is a limitation. My program manager Gregg showed me this nice trick to workaround this problem:

      <FIELD name="Iteration Path - Validation" refname="MyFields.IterationPathValidation" type="String">
       <HELPTEXT>Hidden field used to validate Iteration Path</HELPTEXT>
       <WHEN field="System.IterationId" value="XX">
        <COPY from="value" value="Restricted" />
       </WHEN>
       <PROHIBITEDVALUES not = "[project]\Project Administrators">
        <LISTITEM value="Restricted"/>
       </PROHIBITEDVALUES>
      </FIELD>

    Where XX is the Iteration ID of the root level node. Change Iteration to Area for Area Path field. So if you want to prevent users specifying just root node as AreaPath or IterationPath, put the project name (root) there and users will get an error message that "Iteration Path - Validation has invalid value". We are working on improving this area for future releases.

    [Update 8/6/07] I saw post from Paul Chapman on msdn-wiki post on this: http://msdn2.microsoft.com/en-us/library/ms181480(VS.80).aspx#CommunityContent

  • Implementing custom validations in work item form

    Recently few asking me about how to implement custom validation rules in a work item form. Our rules in work item form XML is extensive and that covers lots of scenarios. But still it doesn’t meet everyone’s needs and it leaves some holes such as not being able to add rules for AreaPath and IterationPath fields. We are investigating fixing those holes and coming up with a long term solution for extensible rules creation in future versions. This post is about achieving limited customization in V1 and in Orcas.

     

    Custom Validations Limitations:

     

    For now in V1 and in Orcas, it is possible to create custom rules in work item form, but it has below significant limitations:

    -          The rules work only when data is entered in work item form in VS. So someone could bypass it by changing data using object model, excel integration or using web service.

    -          Since addins/packages are optional, users without that addin/package will bypass those rules. These rules addins need to be deployed in each user’s client machine.

     

    If these limitations are okay, a VSIP package can be created to achieve this. Some validation could be done using custom controls, but it also suffers with similar limitations above and it doesn’t have support for hooking to save event. Because of these limitations, this functionality was not documented and advertised in V1.

     

    User experience on custom validation:

     

    How would the experience be for users with custom validations in VSIP package? Users will fill in the form as usual, but during save time there’ll be an error stating what the issue was and the save would be aborted. Users can fix the issue and retry save. The validation message could also be thrown when specific field values are changed to invalid value as deemed by the custom rules. The invalid field could not be highlighted though like we do with standard rules.

     

    If validations are done in a custom control, then the control needs to throw validation exception on each field value change. There isn’t an way to hook to save event of the form. Since building a VSIP package to do it take a little while, this cheaper custom control solution might work for you. Inside our teams, we built a VSIP package with few rules and bundled this package + various custom controls as one setup package and distributed to hundreds of users. Custom control documentation is here.

     

    There were attempts to implement security of some form using this technique. But as you see from limitations, it is easily by-passable by various means, so it is not true security. It is also not possible to disable controls/tabs in the form using this approach (only your own custom controls can be made disabled).

     

    Steps to build validation VSIP package with addin interfaces:

     

    -          Go over the addin post here to get overview on how Document Service works.

    -          Create a VSIP package with below attribute set on the package. It basically asks the package to load after loading Team Explorer. That way we can get reference to document service. This is the reason why a VSIP package is used instead of a simpler Addin.

    [ProvideAutoLoad("{E13EEDEF-B531-4afe-9725-28A69FA4F896}")] // UI Context used by the Team Menu

     

    -          Add WIT references to this project as explained in Ed’s blog post here.

    -          During initialization of the package, get pointer to DTE object by calling (EnvDTE.DTE)this.GetService(typeof(EnvDTE.DTE))

     

    -          Get reference to DocumentService by calling (DocumentService) this.GetGlobalService(typeof(DocumentService));

     

    -          Hook to DocumentAdded and DocumentRemoved events. This event is raised each time a workitem form is opened in VS and hence you can enforce your validations. Example here:

     

                DocumentService.DocumentAdded +=  new DocumentService.DocumentServiceEventHandler(DocumentService_DocumentAdded);

                DocumentService.DocumentRemoved +=  new DocumentService.DocumentServiceEventHandler (               DocumentService_DocumentRemoved);

     

    -          In the hooked events, hook to WorkItemDocuments Saving/Saved events. Example:

            void DocumentService_DocumentAdded(object sender, DocumentService.DocumentServiceEventArgs e)

            {

                IWorkItemDocument doc = e.Document as IWorkItemDocument;

                if (doc == null)

                    return;

     

                doc.Saving += new WorkItemTrackingDocumentEventHandler(Doc_Saving);

                doc.Saved += new WorkItemTrackingDocumentEventHandler(Doc_Saved);

                doc.Loaded += new WorkItemTrackingDocumentEventHandler(Doc_Loaded);

                doc.Closed += new WorkItemTrackingDocumentEventHandler(Doc_Closed);

            }

     

            void DocumentService_DocumentRemoved(object sender,

                DocumentService.DocumentServiceEventArgs e)

            {

                IWorkItemDocument doc = e.Document as IWorkItemDocument;

                if (doc == null)

                    return;

     

                doc.Saving -= new WorkItemTrackingDocumentEventHandler(Doc_Saving);

                doc.Saved -= new WorkItemTrackingDocumentEventHandler(Doc_Saved);

                doc.Loaded -= new WorkItemTrackingDocumentEventHandler(Doc_Loaded);

                doc.Closed -= new WorkItemTrackingDocumentEventHandler(Doc_Closed);

            }

     

    -          In Saving event implement your validations. The Item property on the document has the WorkItem object for checking various fields. In the data is invalid, raise an exception with the message to be shown to user. This prevents saving the work item. Saved event can be used for post-save operations. Loaded & Closed will be raised once per document open/close, but saving could happen many times when the document is open.

     

     

  • Screen shot capture custom control

    Mathias sent me link to the custom control he built to capture screenshots. He also created a control similar to attachments control with capture button. Looks good! We hope to add it to custom controls codeplex project. I was not able to spend any time on that project yet, but I hope I could in near future.

More Posts Next page »

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker