DCSIMG
October 2008 - Posts - Shai Raiten's Blog

Shai Raiten's Blog

It's all about code...

October 2008 - Posts

Team System Users Group Meeting- Virtual Edition

Team System Users Group Meeting- Virtual Edition

You want to know more about Team System?

Leaving the home is a problem?

I have the perfect solution for you: Virtual User Group

If you want to join us ,The next meeting - In Friday, October 31st at 6PM (Israel Time) all TSUG-VE members are invited to attend join us on Microsoft Island

TSUG Home Page

Hope to see everyone there!

Let’s Report With Team System

Let’s Report With Team System

I started to write copule of posts and screencast about Team System Reporting.

In those posts and screencast I’ll explaine the significance and probabilitys for using Team System Reports.

Here is a glimpse:

  • Understanding the Data Warehouse Architecture
  • Understanding the TFS Cube
  • Creating and Customizing TFS Reports
  • Report Designer
  • Aggregate Report
  • Detailed Report
  • MDX & T-SQL
  • Training and Examples

How To: Manage Custom Controls In Team System and Web Access

How To: Manage Custom Controls In Team System and Web Access

Here is couple of question I'm hearing from people about Custom Controls:

1. Why after I add a custom control to my work item I see an error message in the Web Access?

Unable to create workitem control

2. Even when I have Web Access Custom Control and Team System Custom Control I can't get them to work together, always one of them shows me an error, Why?

|Web Access - Unable to create work item control

Custom Control in WinForm

Answers:

1. Custom Controls for Team System and for Web Access are different!
How To Write Team System Custom Controls
How To Write Web Access Custom Control

2.Because those Custom Controls are different you need to modify the Work Item definition for Team System and Web Access.

This is how you do it:

First install TFS PowerTools 2008.

Use Process Editor to export the Work Item we want to modify.

Export Work Item

After we export the work item to our local drive, open it for edit.

Inside the Work Item Definition Duplicate the <Layout> information and add Target Attribute.
One Layout with Target="WinForms"
And the other one with Target="Web"

Add new Layout

Now you got two options:

1. If you only have Team System Custom Control, Remove the Custom Control within the <Layout Target="Web"> .
So now in the Team System you will see the custom control and in the Web Access this Custom Control will be gone!

2. If you have both Custom Controls , Web Access and Team System, just replace the name of the Custom Control.

<Layout Target="WinForms">
......
<Control Type="Forms_CustomControl" Label="Custom Control For WinForms" LabelPosition="Left" />

<Layout Target="Web">
......
<Control Type="Web_CustomControl" Label="Custom Control For Web" LabelPosition="Left" />

After you finish modifying the Work Item Definition use process editor to import the changes.

Import Work Item

Perform iisreset /restart to apply changes in Web Access.

Enjoy.

How To: Write Web Access Custom Controls

How To: Write Web Access Custom Controls

Before you start writing Web Access Custom Control install PowerTools 2008.Web Access Demo Project

After installing TFS PowerTools 2008 open "Work Item Custom Control Reference.doc".
You can find this file in "Program Files\Microsoft Visual Studio 2008 Team System Web Access\Sdk"

"Work Item Custom Control Reference.doc" is a full tutorial on how to write Web Access Custom Control.

In the same folder you will have a project contains lots of examples for ready Web Access Custom Controls.

I'll soon publish my own examples on how to create Web Access Custom Controls.

Enjoy

Using Team Foundation Server to Develop Custom SharePoint Products and Technologies Applications

Using Team Foundation Server to Develop Custom SharePoint Products and Technologies ApplicationsCc948982_55960e2f-f1a5-4cd3-af1f-4c563fccc04e(en-us,office_12)

Here is a nice article about how to use Microsoft Visual Studio 2008 Team Foundation Server to support SharePoint application development, and provide an integrated development environment and single source code repository for process activities, integrated progress reporting, and team roles.

http://msdn.microsoft.com/en-us/library/cc948982.aspx

How To: Write Team System Custom Control

How To: Write Team System Custom Control

In this tutorial I'll show how to create simple Team System Custom Control.

Create new project:

Add reference to:
(Version 9.0.0.0 for Visual Studio 2008)

  • Microsoft.TeamFoundation.WorkItemTracking.Controls
  • Microsoft.TeamFoundation.WorkItemTracking.Client

You can find those dll's in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies

Add using

using Microsoft.TeamFoundation.WorkItemTracking.Controls;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

Add new User Control and lable.

image

 

public partial class Header : UserControl, IWorkItemControl

    {

        private System.Collections.Specialized.StringDictionary properties;

 

        private bool readOnly = false;

 

        public Header()

        {

            InitializeComponent();

        }

 

        #region IWorkItemControl Members

 

        /// Raise this events before updating WorkItem object with values. When value is changed by a control, work item form asks all controls (except current control) to refresh their display values (by calling InvalidateDatasource) in case if affects other controls

        public event EventHandler BeforeUpdateDatasource;

 

        /// Raise this event after updating WorkItem object with values. When value is changed by a control, work item form asks all controls (except current control) to refresh their display values (by calling InvalidateDatasource) in case if affects other controls

        public event EventHandler AfterUpdateDatasource;

 

        /// Control is asked to clear its contents

        void IWorkItemControl.Clear()

        {

        }

 

        /// Control is requested to flush any data to workitem object. This usually happens during save operation or when the form is left. In most cases data will be written to workitem immediately on change and hence this will not need implementation. Some customers want a way to do operations during save, and this is the closest thing we got. If you do need a way to react to before-save & after-save events, pls let us know in forums given below and we'll consider for future revision.

        void IWorkItemControl.FlushToDatasource()

        {

            this.BeforeUpdateDatasource(this, EventArgs.Empty);        

            this.AfterUpdateDatasource(this, EventArgs.Empty);

        }

 

        /// Asks control to invalidate the contents and redraw. At this point, control can read from work item object and display/refresh data.

        void IWorkItemControl.InvalidateDatasource()

        {

            try

            {

                string WitType = m_workItem.Type.Name;

                label1.Text = WitType;

                switch (WitType)

                {

                    case "Bug":

                        this.BackColor = Color.Blue;

                        break;

                    case "Task":

                        this.BackColor = Color.Brown;

                        break;

                    case "Requirement":

                        this.BackColor = Color.Pink;

                        break;

                    default:

                        this.BackColor = Color.White;

                        break;

                }

            }

            catch (Exception ex)

            {

            }

        }

        /// A property bag of all attributes specified in work item form xml for this control. Custom attributes are allowed and can be used to pass parameters specific for this control from work item type xml.

        System.Collections.Specialized.StringDictionary IWorkItemControl.Properties

        {

            get { return properties; }

            set { properties = value; }

        }

 

        /// Tells the control to display in readonly mode.

        bool IWorkItemControl.ReadOnly

        {

            get { return readOnly; }

            set { readOnly = value; OnReadOnlyChanged(); }

        }

 

        /// Gives pointer to IServiceProvider if you intended to access Document service or VS Services. If services are not needed, do nothing in this method.

        private IServiceProvider m_serviceProvider;

        void IWorkItemControl.SetSite(IServiceProvider serviceProvider)

        {

            m_serviceProvider = serviceProvider;

        }

 

        private WorkItem m_workItem;

        object IWorkItemControl.WorkItemDatasource

        {

            get

            {

                return m_workItem;

            }

            set

            {

                m_workItem = (WorkItem)value;

            }

        }

 

        /// The field name if the control is associated with a field name in work item form xml. A custom control can be associated with 0 or 1 work item field.

        private string m_fieldName;

        string IWorkItemControl.WorkItemFieldName

        {

            get

            {

                return m_fieldName;

            }

            set

            {

                m_fieldName = value;

            }

 

        }

        #endregion

 

        private bool IsInitialized()

        {

 

            return (!this.IsDisposed &&

                m_workItem != null &&

                !string.IsNullOrEmpty(m_fieldName) &&

                m_workItem.Fields.Contains(m_fieldName));

        }

 

        private void OnReadOnlyChanged()

        {

        }

    }

 

Custom Control

You can download the Project from Here

Exclude File From Code Churn

Exclude File From Code Churn

If you want to exclude specific file from the code churn in TFS Reports look in Neno Loje blog.

Disadvantages:

  • Comparing binary files in the command line or UI will just result in "Binary files differ" rather than a diff viewer showing the changes.
  • By default, multiple checkouts of binary files are not allowed.

Team System *Virtual* User Group in Second Life

Team System *Virtual* User Group in Second Life

I had a great time sitting with my Second Life character in Microsoft Land and hear lectures from 2 MVP's.

David McKinstry & Paul Hacker gave a very good presentations on Team System,
There are some things worth to be awake in 03:00 - 04:30.

Intro Session:
Visual Studio Team System 2010 unveiled with David McKinstry

General Session:
Managing Database Development with VSTS by Paul Hacker

The idea of Virtual User Group is  A M A Z I N G!!!

Snapshot1_006 Snapshot1_007 Snapshot1_008 Snapshot_001

Custom Validation & Extraction Rules for InnerText and Selected Tag

Custom Validation & Extraction Rules for InnerText and Selected Tag

If you need a Custom Validation / Extraction rule to handle InnetText or Selected Tags in web test or load test you can download it from codeplex - http://codeplex.com/teamtestplugins

Tips for Setting Up TFS with SSL

Tips for Setting Up TFS with SSL

John Burns published a very nice article about setting TFS to work with SLL.

There is very good tips for this subject.

How to set up TFS 2008 SP1 to use TSWA links

How to set up TFS 2008 SP1 to use TSWA links

Published On Buck Hodges & bharry's blog.

In TFS 2005 you can configure work item hyperlinks that are sent from Team Foundation Server or Team Explorer to link to Web pages in Team System Web Access - Link between Team System Web Access to TFS notifications

But in TFS 2008 SP1 it's easier, you can use tfsadminutil util

  • Open a Command Prompt window and move to the following subdirectory:
        \Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools

  • Type tfsadminutil configureconnections /tswauri:http://TSWA computer:port

    TFS 2008 SP1 had a bug that caused checkin notifications to fail when you've used the new tfsadminutil configureconnections options to configure the URL to your Team System Web Access

    You must install the following fix (QFE) in order to use the feature: KB957196 - Checkin event e-mail alert notification doesn't work (download).

  • TF51655 When Trying To Delete Global List

    TF51655 When Trying To Delete Global List

    I create a Service that ones a day create a Global List of customers from CRM system and export to TFS.

    This Global List contains over 3000 items.

    When I tried  to Delete this Global List using Process Editor I get this message:

    51655

    So I tried  using Power Tools 2008 Command-Line - Using Tfpt Command Line Tool

    51655-Command-Line

    The Solution:

    Edit the Global List and remove all items (Leave one item.....) and make sure this Global List have the same name like the Global List You want to Delete and import the Global List to TFS.

    How To: Get Build List Using TFS API

    How To: Get Build List Using TFS API

    Here is a example how to use TFS API to get Builds List per project.

    In the next post I'll show how to use GetListOfBuild as a Team Build Task that will help you override BuildNumberOverrideTarget.

    using Microsoft.TeamFoundation.Build.Proxy;

    TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(tfsUrl);
    BuildStore buildStore = (BuildStore)tfs.GetService(typeof(BuildStore));
    BuildData[] allBuilds = BuildStore.GetListOfBuilds(TeamProject, BuildType);

        foreach (BuildData build in allBuilds)

        {

            string BuildMachine = build.BuildMachine;

            string BuildNumber = build.BuildNumber;

            string BuildQuality = build.BuildQuality;

            string BuildStatus = build.BuildStatus;

            string BuildStatusId = build.BuildStatusId;

            string BuildType = build.BuildType;

            string BuildTypeFileUri = build.BuildTypeFileUri;

            string BuildUri = build.BuildUri;

            string DropLocation = build.DropLocation;

            string FinishTime = build.FinishTime;

            string LastChangedBy = build.LastChangedBy;

            string LastChangedOn = build.LastChangedOn;

            string LogLocation = build.LogLocation;

            string RequestedBy = build.RequestedBy;

            string StartTime = build.StartTime;

            string TeamProject = build.TeamProject;

         }

    MSBuild Extension Pack

    MSBuild Extension Pack

    New project has recently published on Codeplex - MSBuild Extension Pack

    Project Description
    The MSBuild Extension Pack is the successor to the FreeToDev MSBuild Tasks Suite and provides a collection of over 170 MSBuild tasks designed for the .net 3.5 Framework. A high level summary of what the tasks currently cover includes the following:

    More About Creating Work Item Using TFS API

    More About Creating Work Item Using TFS API

    In my last post How To: Create Generic Work Item Migration Tool For TFS I explained how to create Work Item Using TFS API.
    In this post I'll show more options available using the API.
     
    First create the connection to TFS and Work Item Store.
     

    TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(ServerName); WorkItemStore store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));

    WorkItemTypeCollection workItemTypes = store.Projects[TFSProject].WorkItemTypes;

     
    Open The Work Item With PartialOpen()
    Opens this WorkItem for editing without transferring all the data about the work item over the wire.
    workitem.PartialOpen();
     
    Copy Work Item
    WorkItem NewWIT = workitem.Copy();
    
    WorkItem NewWITTask = workitem.Copy(workItemTypes["Task"]);
     
    Reset Work Item
    Reverts all changes that were made to this WorkItem since the last revision.
    workitem.Reset();
     
    Related Link - Create a Work Item Relation between Work Items
    RelatedLink rl = new RelatedLink(324);
    workItem.Links.Add(rl);

    Hyper Link - Create a Hyper Link

    Hyperlink hl = new Hyperlink("http://blogs.microsoft.co.il/blogs/shair");
    hl.Comment = "Shai Raiten Blog";

    External Link - Create link to "Test Result" , "Changeset", "Version Item"

    RegisteredLinkTypeCollection linkTypes = store.RegisteredLinkTypes;
    
    RegisteredLinkType changeset = linkTypes["Changeset"];
    RegisteredLinkType versionitem = linkTypes["Versioned Item"];
    RegisteredLinkType testresult = linkTypes["Test Result"];
    
    ExternalLink el1 = new ExternalLink(changeset, "53421");
    ExternalLink el2 = new ExternalLink(versionitem, "$/BuildProject/Main/WindowsFormsApplication1/Form1.cs");
    ExternalLink el3 = new ExternalLink(testresult, "UnitTest1 from tfsBuild@TFSRTM08 2008-09-24");
    
    workItem.Links.Add(el1);
    workItem.Links.Add(el2);
    workItem.Links.Add(el3);

    Remove Link

    LinkCollection WITLinks = workitem.Links;
    WITLinks.Remove(el1);
    WITLinks.Remove(hl);

    To add Iteration Path & Area Path you need to write the full path using \

    workitem.IterationPath = @"Main\Project\Product\Item";
    workitem.AreaPath = @"Main\Project\Product\Item";

    Using Query to find Work Items

    string query = "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = 'MyProject'";
    WorkItemCollection witlist = store.Query(query);
    More Posts Next page »