TFS & Visual Studio ALM - by Neno Loje

(formerly Team System, VSTS)

News

Recent Posts

Community

Tags

Email Notifications

VSTS Blogs

VSTS Community

My Other Blogs

German VSTS Websites

Archives

January 2009 - Posts

Hotfix for Team Build 2008 SP1: Reducing project-to-project references in build log (KB958845)

From Aaron Hallberg blog:VS08-TeamSys-TFS_v_rgb_2

[…] change in TFS Build SP1 which reduced build log noise by cutting out the build steps for project-to-project references […] the fix in SP1 didn't actually fix the problem, at least not completely.

[…] As such, if a project was referenced by 10 other projects the fix in SP1 would reduce the number of spurious build steps from 10*3 to 9*3 rather than removing them altogether.

A hotfix is finally available that will address the remaining parts of the problem […]

VSTS MVP colleague Mathias Olausson reports:

“before SP1 the build time was about 2h 30 min, with SP1 build time in average 65 minutes and with the build hotfix we’re now down to less than 40 minutes. The build log has changed from 5500 lines down to 550.”

Download hotfix: TFSBuild TargetsNotLogged property fails to cut down noisy builds

Additional Info: KB article 958845

Security Update for TSWA 2008 SP1

protected_83f8084f-8b20-45d5-8b17-67b0b449e38cFrom Hakan Eskici's blog:

A security issue has been identified with Team System Web Access 2008 SP1 and we have recently published an update that fixes it.

Installation Notice

Please note that this is a full release, so you will need to uninstall any existing versions of Web Access before installing this update.

Update: Instructions to patching your installation without the need to uninstall/reinstall TSWA)

Update #2: KB article 961267 is now available.

Determining if the update is installed

Take a look at the About page (Help > About) in Web Access.
The version number will be 9.0.3275 for TSWA 2008 SP1 Update.

Download: Visual Studio Team System Web Access 2008 SP1 Power Tool

How many users can Team System Web Access support?

A: Microsoft posted a white paper on this.

TSWAScalability

From the whitepaper:

"Test results indicate that Web Access starts to hit the upper limits once the total number of work item objects in the memory is around 180. This translates to approximately 100 concurrent users with typical usage patterns."

"Test results indicate that Web Access can support up to approximately 500 users." (working with a minimum amount of data)

Download: Team System Web Access 2008 Scalability Limits White Paper

VSTS Whitepapers by Microsoft

Planning

Installation, Configuration & Administration

Requirements Management

Version Control

How TFSDeleteProject Works

There are some areas where data may remain behind after you use TFSDeleteProject.

  • The TFS Warehouse is untouched. In order to remove the data from the warehouse, it must be rebuilt. (It is important to notice that, when the warehouse is rebuilt all the historic build data that has been trimmed from the system will be removed.) Rebuilding the warehouse is accomplished using the command SetupWarehouse. For more information, see SetupWarehouse.
  • The build drop locations (i.e., the location where the build binaries, build log files, and test results log files are published during the build process) are untouched. Removing the build drops must be done manually.
  • Any work item tracking metadata that is shared between projects will not be deleted.
  • The version control shelve set may not be deleted if there is code in the shelve set from multiple projects.

Read the full story by Aaron Block.

Download: Visual Studio 2008 Project Template for TFS Utilities

If you develop small utilities for Team Foundation Server a lot you might want to save some time and use a project template (see bottom for file attachment) that already comes equipped with the correct references to the Team Foundation Object Model (Microsoft.TeamFoundation.*.dlls) as well as the most important using statements and a few lines of code to get started.

Installation

Copy the ZIP file to {MyDocuments}\Visual Studio 2008\Templates\ProjectTemplates.

Usage

Create a new project and select “TFS Utility” from the “My Templates” list.

TFS Utility Project Template

The template creates a new Windows Forms application with references to the Microsoft.TeamFoundation.*.dlls (btw: the C# compiler gets rid of all references that were not used in the project during compilation)…

References to Team Foundation Object Model 

… as well as a a few using statements and some code to start from.

Generated code in Form1.cs

Happy TFS tool development!

 

Download: TfsUtility.zip

Update (Nov 13, 2011): There is an updated version available for VS 2010.

Specifying a user upfront or: How is the developer supposed to know who will be the responsible tester?

In a small team this sounds like oversize, but in mid-sized large teams it's common that you do not know who is going to be the tester.

Looking at the Bug workflow from MSF Agile:

  1. while "Active" the project lead decided if and when the bug is going to be fixed and assigns it to the responsible developer.
  2. between "Active" and "Resolved" is where the developers implements the fix.
  3. between "Resolved" and "Closed" is where the tester verifies the fix.

MSF Agile Bug workflow

When the developer finishes coding he changes the state from "Active" to "Resolved", e.g. by checking in and associating the changeset with the work item.

But by doing so the work item is still assigned to him. In our scenario he doesn't know who will be the responsible tester to verify the fix. So who knows?

The project lead might have that information. So either we assign it back to the project lead to make him assign it to as tester or we make the project lead specify the tester upfront (with the ability to change it afterwards if necessary).

In this example we'll implement the second approach.

Objective

Ask for the Tester when creating the bug and automatically u.se it for the transition from "Active" to "Resolved"

Required Work Item Customization

Step 1: Add a new string field to hold the tester
In this example we will make it a required field (<required/>) and ensure that it contains a valid user (<validuser/>).

<FieldDefinition> type="String" name="Tester" refname="TeamSystemPro.Samples.Tester">
  <REQUIRED />
  <VALIDUSER />
</FieldDefinition>

Step 2: Add a rule to the transition from "Active" to "Resolved"
Automatically copy the value of the tester field to the Assigned to field.

<FieldReference refname="System.AssignedTo">
  <COPY from="field" field="TeamSystemPro.Samples.Tester" />
</FieldReference>

Result

When creating a new bug it's now required to select a Tester before it can be saving.

Creating a new bug requires a tester to be specified

When choosing "Resolved" for the state "Assigned to" will be automatically filled with the contents from the "Tester" field.

Transitioning to resolved copies the tester to the Assigned to field

The history correctly shows the change in the "Assigned To" field from the developer (here: "Neno Loje" to the tester (in this case: "Administrator")

History displays the change in Assigned to field

Happy Customizing!

Using TFS for non-development projects

Team Foundation Server is easily customizable and equipped with a general purpose workflow or state machine. So you might ask yourself: why not put a non-development or rather related process in TFS instead of using separate software.

Showcase #1: Lead Management

AIT_TeamSystemPro_Team_klein_120x58Since here at AIT TeamSystemPro Team we are TFS consultants we decided to not use a commercial CRM tool for managing our leads but rather customize a team project in TFS for this matter.

Here are a few impressions of the experience:

Leads in Excel 

Work Item queries:

Work Item Queries for our Leads

Work Item layout:

Leads - Work item Layout

in Outlook (via TeamCompanion)

Leads in Outlook

Leads in Outlook (2)

The pretty simple workflow behind it:

lead workflow 

Showcase #2: Customer Support

Needless to say that the TFS support that we offer is tracked using work items as well:

Support Case work item

Customer Support Queries

Showcase #3: List of managed TFS instances

Every TFS instance that we manage has a corresponding record:

TFSInfo7880

Your Feedback

Do you have an interesting idea or have you used your TFS to support a non-dev related process? Feel free to leave me a comment or use the contact link – thanks!

Changing TFS emails to link to Team System Web Access – Part 2

If you click on a hyperlink in an TFS notification mail the following (read-only) web page comes up instead of a nice looking Team System Web Access dialog. Let's change that!

The days before Team System Web Access

Objective

Make sure all links in the notification mails sent by TFS point to Team System Web Access (TSWA) rather than the integrated read-only web pages from TFS.

There are fourareas to look at:

  1. Work Item notification mails (has already been discussed here)
  2. Build notification mails
  3. Check-in notification mails
  4. Mails sent by Team Explorer (feature of TFS 2008 SP1)

Area 1 is part of a separate blog post, for Area 2 there are currently no equivalent steps (as stated in KB956761). Areas 3 and 4 can be accomplished through the following steps:

Step 1: Specify TSWA Uri using tfsadminutil

Set TSWA uri (as described on MSDN):

tfsadminutil configureconnections /TSWAUri:http://MyTFS:8090/

tfsadminutil configureconnections /TSWAUri

Verify URIs:

tfsadminutil configureconnections

Verify URIs

From now on all your check-in notification mails as well as mails sent via Team Explorer link to TSWA.

Unfortunately there's one problem if we look at the check-in notification mail we'll read:

"Details about his check-in were not available when this alert was prepared.
Select the link above to view more details about the check-in."

Before applying the hotfix

Microsoft released a hot fix to correct this behavior.

Step 2: Install hot fix

The hot fix is publically available at: http://code.msdn.microsoft.com/KB957196

Install Hotfix - Step 1 Install Hotfix - Step 2

Install Hotfix - Step 3 Install Hotfix - Step 4

Result

After applying the hot fix

Way better, don't you think?

Be aware: don't use underscores in server names

An underscore ("_") is not a supported character for a server name according to the RFC standards and therefore Windows will warn you when trying to use it as part of a DNS name.

Symptoms

ASP.NET applications that use session state, like Team System Web Access, will work when invoked using the IP (http://1.1.1.1:8090/) but will fail after some crazy redirecting with a DNS error when using the server name (http://my_tfs:8090/).

Workaround

You can add a DNS alias and avoid using underscores in server names in the future.

 

(Thanks to Hakan Eskici from Microsoft for pointing this out.)

Update: Hakan now blogged about this: Strange TSWA connection issue if the server name contains an underscore character.

Update #2: Microsoft published KB article 968549 about this.

Using rich HTML descriptions instead of plain text

Objective

Allow rich HTML formatting in description fields of the MSF Agile process template.

Note: The MSF CMMI process does support HTML formatting by default. In order to use it you have to enable the formatting toolbar (see Step 6 below).

Work Item Customization

Step 1: Add a new HTML description field

Since the System.Description field is defined of type string as opposed to type HTML we need to create a new field:

2AddNewField

3AddNewField

Step 2: Change the work item layout

Use your own HTML field instead of System.Description

4EditLayout

Step 3: Refresh Work Item cache

Right-click "Work Items" in Team Explorer and select "Refresh".

5RefreshWIs

Step 4: Enable the formatting toolbar

Right-click on the Visual Studio toolbar, find and click "Formatting":

6EnableFormattingToolbar

A new toolbar will appear:

7FormattingToolbar

Result

Click into the description field and use the toolbar to format your input:

8UsingRichFormatting

 

Optional Step 5: Copying the old descriptions to the new HTML field

It would be a pity to loose the existing descriptions so let's write a small utility using the Team Foundation Object model to copy the "old" descriptions to the new HTML field:

static void CopyOldDescriptions()
{
    // TODO: Change these values:
    string tfsName = "servertogo";
    string tfsProjectName = "WorkItemCustomization";
    string tfsHtmlDescriptionFieldName = "DescriptionHtml";
    string tfsWorkItemType = "Task";

    using (TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(tfsName))
    {
        WorkItemStore wit = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
        WorkItemCollection result = wit.Query(String.Format("SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = '{0}' AND [System.WorkItemType] = '{1}'", tfsProjectName, tfsWorkItemType));
        List<WorkItem> affectedWorkItems = new List<WorkItem>();
        foreach (WorkItem wi in result)
        {
            if (wi.Description.Length > 0)
            {
                // Set new description
                string value = (string)wi[tfsHtmlDescriptionFieldName];
                if (String.IsNullOrEmpty(value))
                {
                    wi[tfsHtmlDescriptionFieldName] = wi.Description.Replace("\n", "<br>");
                }
                else
                {
                    wi[tfsHtmlDescriptionFieldName] += "<br><p>Old description:</p><p>" + wi.Description.Replace("\n", "<br>") + "</p>";
                }

                // Delete old description
                wi.Description = String.Empty;

                affectedWorkItems.Add(wi);
            }
        }

        if (affectedWorkItems.Count > 0)
        {
            wit.BatchSave(affectedWorkItems.ToArray());
            MessageBox.Show("Items updated: " + affectedWorkItems.Count);
        }
        else
        {
            MessageBox.Show("Nothing to do.");
        }
    }
}

Happy formatting. :-)

 

How to revert changes checked into TFS Version Control

Objective

We did some changes to a file and now want to revert to an older version of that same file. In the concrete scenario we added a method called "Multiply" with changeset 8 and want to go back to the version of changeset 7.

History of the file

Step-By-Step guide using the UI

Step 1: Get the version of the file you want to revert to into your workspace

Rightclick > Get specific version

Choose a version

Find Changeset

Note: verify that the file really contains the version you expect and want to revert back to!

Step 2: Check out the file for editing

Check Out for Edit

Select Lock type and confirm check out 

Note: You can freely specify a lock here to make sure none else checks in a new version of the file you are just trying to revert

Newer version exists in source control

Step 3: Check in the change you just made

Check In

Check In Dialog

Your check-in will generate a version conflict:

Resolve Conflicts

This conflict has to appear so that you don't accidently check in old stuff. You now have to confirm that you really want to override the version that is currently checked in with the older version in your workspace.

Resolve Version Conflict 

The conflict is now resolved:

All conflicts resolved

The check-in was aborted due to the conflicts:

No files checked in 

Step 4: Check-in again

Check-In

 File history

Note: If you accidently reverted back to an old version you can use the same steps to open a newer version and upload this as the very latest version again.

Total: 20 clicks.

Alternative using the command-line tools (less clicks)

Instead of 20+ clicks you might think about automating these steps using TF.exe – and are down to 5 commands.

tf get MyClass.cs /version:C8
tf checkout MyClass.cs
tf checkin /noprompt /validate
tf resolve /auto:AcceptYours
tf checkin /comment:"Reverting to older version!" /noprompt

Here's ready to use batch file, which takes two parameters:

  • %1: Name of the file you want to revert.
  • %2: Version of the file, e.g. if changeset number when C7 stands for changeset 7

RevertScript

Revert.bat in action

Although we use command line commands the check in dialog will pop up to allow us to specify check-in comments, notes and associate work items.

 Check In Dialog after Revert.bat

 

Specified cast not valid when trying to create a new work item

Problem description

When trying to create a new work item you receive the following error?

Specified Cast Not Valid

Cause

Thanks to this thread we now know that this message is caused by a DateTime Control in a WIT definition when its associated with a String field.

Fix

Only assign DateTime fields to DateTime controls.

Q: How do I switch Team System Web Access back to English?

Team System Web Access 2008 SP1 comes equipped with 10 languages for its UI that will be displayed depending on your Internet browsers regional settings.

You can set a language - independently what your browser settings by opening the Options dialog from the Settings menu.

TSWA_to_Eng1

and choosing your preferred language on the "Regional settings" tab.

TSWA_to_Eng2

Turn off label deletion when deleting builds

By default a build label is deleted when the corresponding build gets deleted.

In TFS 2008 SP1 you can change that behavior by modifying the web.config file (on the TFS AT in folder %ProgramFiles%\Microsoft Visual Studio 2008 Team Foundation Server\Web Services) to:

<appSettings>
  <add key="PreserveLabelsOnBuildDeletion" value="true" />
</appSettings>

PreserveLabelsOnBuildDeletion

(Thanks to Buck Hodges for this tip).

Workflows of MSF Agile and CMMI Process Templates for TFS

When trying to decide which of the two MSF Process Templates - Agile vs. CMMI Process Improvement - for TFS is the right starting point for your company, it helps to compare the work item types and its workflows.

You can download the full guidance from:

MSF for Agile Software Development

featuring 5 work item types: Bug, Requirement, Quality of Service Requirement (QoS), Risk and Task.

Work Item Type: Bug

msfagile_wi_bug_flow

Work Item Type: Scenario

msfagile_wi_scenario_flow

Work Item Type: Quality of Service Requirement (also known as "technical requirement")

msfagile_wi_qos_flow

Work Item Type: Risk

 msfagile_wi_risk_flow

Work Item Type: Task

 msfagile_wi_task_flow

MSF for CMMI Process Improvement

featuring 7 work item types: Bug, Requirement, Change Request, Issue, Review, Risk, Task

Work Item Type: Bug

cmmi_bug

Work Item Type: Requirement

cmmi_requirement_wit

Work Item Type: Change Request

cmmi_change_request

Work Item Type: Issue

cmmi_issue_wit

Work Item Type: Review

cmmi_review_wit

Work Item Type: Risk

cmmi_risk_wit

Work Item Type: Task

cmmi_task      

As a personal note:

Both templates are a great starting point. The agile template might be a bit more lightweight whereas the CMMI template might fit more the vocabulary and processes that you are used to.

However, both are really just a starting point. In customizing the process you get way more out of TFS than with just using the built-in process templates.

Adding TFS tools to your path environment variable

For easier access to the various command line tools of TFS you can add the necessary directories to your %PATH% environment variable.

Paths to add (on a TFS client)

Drive:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

Paths to add (on a TFS)

Drive:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\TF Setup
Drive:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools

Background

  • The 1rd path contains TF.exe
  • The 2nd path contains BisSubscribe.exe
  • The 3rd path contains tfsadminutil.exe

Note: TFPT.exe add its itself to %PATH% 

How to

2EnvVars

3EditPath

4EditPath

1Extended

Q: How do I disable the Team Members feature of TFPT?

A: You can disable it from the options dialog, however this does not remove it entirely (as described here).

DisableTeamMembers1

To turn it off completely you need to additonally set the following value in the registry:

HKCU\Software\Microsoft\VisualStudio\9.0\TeamFoundation\PowerTools

TeamTrackerHidden = True

DisableTeamMembers2

(Thanks to Bill Essary from Microsoft for this tip)

You can download a ready to use .REG file that does both:

Installing & Configuring Team Foundation Client (aka Team Explorer)

Caution: Make sure to carefully read the Installation Guide before installing this software.

What do I need it for?

  • Access to TFS
    Note: A plain Visual Studio still needs Team Explorer to be able to talk to TFS.
  • It installs:
    • a tiny Visual Studio with only the "Team Explorer" in it if you don't have Visual Studio installed already.
    • a Visual Studio plug-in called "Team Explorer"
    • a plug-in for Microsoft Excel 2003 or 2008
    • a plug-in for Microsoft Project 2003 or 2008
    • the Team Foundation Object Model

Where to find it?

What must be done prior to installing?

 

Workaround for TF30207 when creating a new team project and red X on Reports in Team Explorer

Problem description:

  • You can't create new team projects.
  • You see a red X on Report in Team Explorer, which you are sure is not related to permission issues (as described here).
  • Using tfsadminutil.exe configureconnections /view you discover that the ReportServerUri looks similar to:

http://myTFS/ReportService.asmx

It should look something like:

http://myTFS/ReportServer/ReportService.asmx

Cause:

What happened? Looking at the MSDN docs I found this notice:

ReportServerUriNote

Workaround:

Specify the full path (including the trailing "/ReportService.asmx"), like this:

TfsAdminUtil ConfigureConnections /ReportServerUri:http://myTFS/ReportServer/ReportService.asmx

More information

There is an official KB article by Microsoft available .

You're done!

More Posts Next page »