Changing TFS email notifications to link to Team System Web Access

Thanks to this MSDN Forums post I was able to change the link included in every TFS notification e-mail to point to TSWA instead of the project portal.

Here’s the full story:

When using project alerts to get notified about work item changes you get an email containing a link to the project portal:

Work Item Changed email notification by TFS

If you follow the link you might get a bit dissapointed when looking at this very basic work item details page:

Project Portal Work Item Details

Since Team System Web Access is now avaible from Microsoft free of charge we can change the link in the template for all notification messages to point to the new TSWA.

Changing the e-mail template

  1. On the TFS app tier open the folder:
    %ProgramFiles%\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Services\v1.0\Transforms
  2. Create a backup of the file WorkItemChangedEvent.xsl, which we will be editing in the next step.
  3. Replace the text:

    <xsl:value-of select="DisplayUrl" />

    with:

    <xsl:value-of select="concat(substring-before(DisplayUrl,':8080/WorkItemTracking/WorkItem.aspx?artifactMoniker=’),':8090/wi.aspx?id=’,substring-after(DisplayUrl,’artifactMoniker=’))" />

    The bold printed 8090 is the port where you installed TSWA at.
  4. Save the file and you are done.

If you now get a new notification e-mail and click on the link you’ll see the following much nicer work item details form provided by TSWA:

Team System Web Access Work Item Detail Form

Note: Be aware that you either need to use Windows authentication with TSWA to make this work or you need to be already logged in and the session must be still alive.

 

I published a 2nd part: Changing TFS emails to link to Team System Web Access – Part 2

Tool for creating links to pages on Team System Web Access

Would you like to send links to work items, team projects or source files on  Team System Web Access?

For work items
… you can find the answer in the offical TSWA FAQ:

Q: What’s the URL to use if I want to send the link of a specific work item?

A: Work item links use the follwing format:

http://[TSWA:port]/wi.aspx?id=[WorkItemID]

For Team Projects
… it also pretty simple:

http://[TSWA:port]/index.aspx?pname=[ProjectName]

For Source Files
it’s a little bit more “interesting” (thanks to Hakan from Microsoft for reveiling the details behind this secret).

It’s a bit tricky but here it goes:

http://[TSWA:port]/UI/Pages/Scc/ViewSource.aspx?scc-item=[ItemData]

ItemData is the HtmlEncoded output of the query string something like “id=10&cs=-1”

  • id: the ID of the item in source control (you need to know this instead of the file path)
  • cs: changeset number (-1: latest)

In your example, the file id is 151611. So,

HtmlEncode(“id=151611&cs=-1”) -> “id%3D151611%26cs%3D-1”

https://[TSWA:port]/UI/Pages/Scc/ViewSource.aspx?scc-item=id%3D151611%26cs%3D-1

[We’re planning to provide more friendly URLs in a future version, similar to wi.aspx approach]

To make it fast and more convenient to create links to TSWA I created a small tool to help you with it:

TeamSystemWebAccessLinkCreator

It should be mentioned that this tool has a lot of room for improvement. :-)

You can download the source from an updated version here.

How to remove someone else’s workspace in TFS

A customer asked:


“During my vacation my collegue was working on my machine and mapped the solution file to D:\Projects. Now I returned and wanted to map the solution to that folder as well, which obviously doesn’t work since it is already mapped.

How can I get rid of the workspace that my collegue has on my machine? (Since he won’t be working on my machine anymore it can be freely deleted.)”


First of all: you obviously need to be either the owner of the workspace or have the Administer workspaces permission on the Team Foundation Server to perform this.


Deleting a workspace using the command line


The command is:


tf workspace /delete [/server:servername] workspacename[;workspaceowner]

Deleting a workspace using tf.exe


Source: MSDN


Deleting a workspace using GUI


If you prefer a rich UI you can use the free Team Foundation Sidekicks tool by Attrice Corp.


Deleting Workspaces using Team Foundation Sidekicks

Hotfix for: Microsoft.TeamFoundation.VersionControl.Adapter: An error occurred while processing changeset

If you have the following error occurring every periodically when your warehouse is updated…


Event Log Screenshot


The description text is as follows:


Event Type: Error
Event Source: TFS Warehouse
Event Category: None
Event ID: 3000
Date:  nn/nn/nnnn
Time:  10:58:00
User:  N/A
Computer: Computer name
Description:
TF53010: An unexpected condition has occurred in a Team Foundation component. The information contained here should be made available to your site administrative staff.
Technical Information (for the administrative staff):
Date (UTC): 30.08.2007 08:58:00
Machine: Computer name
Application Domain: /LM/W3SVC/3/Root/Warehouse-3-128328371118437500
Assembly: Microsoft.TeamFoundation.Warehouse, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
  Process Name: w3wp
  Process Id: 3413
  Thread Id: 4027
  Account name: TFSService Account

Detailed Message: Microsoft.TeamFoundation.VersionControl.Adapter: An error occurred while processing changeset ChangesetID, unexpected exception:
Exception Message: Object reference not set to an instance of an object. (type NullReferenceException)

Exception Stack Trace:    at Microsoft.TeamFoundation.VersionControl.Adapter.VCAdapter.persistChangesetInformation(FilePair fp, String sidForUserThatMadeChange, Boolean doOnlyRenameDebit)
   at Microsoft.TeamFoundation.VersionControl.Adapter.VCAdapter.processChangesets()

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


… there is help! Microsoft released a hot fix a few days ago:


FIX: When the Microsoft.TeamFoundation.VersionControl.Adapter adapter processes a changeset, the adapter may fail in Visual Studio 2005 Team Foundation Server
Get it at: http://support.microsoft.com/kb/940229/


 

Creating a separate work item form layout for Web Access

Right now custom work item controls [1] are not supported by Team System Web Access [2]. Instead your custom control you will see this unpleasant message: “Unable to create workitem control ‘ControlName’”.


Error message when opening a work item with custom controls on the web


While this is a sad thing for us users does that mean that we shouldn’t use Web Access? No, of course not…


One solution is to create a separate work item form layout for Web Access and remove all custom controls from it. (thanks to Serkan and Marcus for pointing me in that direction.)


All you need to do is duplicate the <layout> information in your work item xml file.


Let’s do it


The first section gets a target-attribute with the value “WinForms” like this:


<Layout Target=“WinForms”>


The second targets the “Web”:


<Layout Target=”Web”>


Last thing you need to do is change the “Type” attributes of all controls in the web layout to use “FieldControl” instead of your custom control.


Review the results


If you take my Priority Control example from [1] it would look like this:


Windows layout (in Team Explorer) will show the friendly priority list (= the custom control):


A Work Item Custom Control in Team Explorer


Web layout in Team System Web Access doesn’t show the control, but instead it displays the regular field control. Not nice, but usable – and much better than the initial error message we had.


Regular work item field control in the web


[1] http://msmvps.com/blogs/vstsblog/archive/2007/07/07/starting-using-custom-work-item-controls.aspx


[2] http://msmvps.com/blogs/vstsblog/archive/2007/08/27/free-add-on-team-system-web-access-tswa-power-tool-by-microsoft.aspx

Listing version control changes with check-in comments using TFS

You can easily query for changes on a team project or a specified version control folder underneath and display them in a list with the check-in comments.


By using Team System Web Access (TSWA):


Note: I’m showing this first because the dialog is very comfortable, e.g. you can filter by user or time range.


  1. In TSWA on the “Source” tab, right-click any folder (team project folder or sub-folder) and select “Find Changesets”.

    1_TSWA_Step1
  2. In the “Find Changesets” dialog, select the desired filter criteria and confirm with “Find” to generate a list of changesets with check-in comments.

    2_TSWA_Step2

By using Visual Studio Team Explorer:


  1. In Team Explorer under “Source Control”, right-click any folder and choose “View History” from the context menu.

    3_TFC_Step1
  2. The “History” window is shown with a list of all changesets (again with check-in comments) of the folder and sub-folders, which – as far as I know – cannot be filtered further.

    4_TFC_Step2

By using Team Foundation Sidekicks (a free tool by Attrice):


  1. Start Team Foundation Sidekicks and open the History Sidekick by clicking on the third toolbar button (the clock with an arrow on it).
  2. On the left side, select a folder by clicking on it.
  3. On the right side in the “History” tab you will see the changes with an option to filter them by user.

    5_TFSidekicks

Enabling email functionality in Team System Web Access (TSWA)

By default, the email functionality in Team System Web Access (TSWA) is disabled and users will receive the following message when trying to use it:


“Sending email is not enabled. Please contact your administrator.”

0_EmailDisabled


To enable you need to change TSWA’s web.config file, which can be found under %ProgramFiles%\Microsoft Visual Studio 2005 Team System Web Access\Web.


  • Change the setting “sendingEmailEnabled” to true.
  • And specify your SMTP server name under “host”.



1_ModifyWebConfigFile


Optionally you can specify which account to use when authenticating with the SMTP server and if SSL should be enabled as well as the default email address for the sender.


Where can you use the email functionality?


You can send…


  • single work items (from the work item form)
  • multiple work items, i.e. the result of a work item query

The email function can be found in the “Tools” menu.



5_SendWIEmail


The “Send Email” window allows you to specify the sender’s (“From”) and receiver’s (“To”) email address, as well as subject and message.



2_SendEmail


After hitting send a message box confirms that the mail was successfully routed to the email server.



3_EmailSent


This is how the receiver will see the message if it’s about a single work item:



4_MailReceived


… or about a work item query result:


6_MultipleWorkItems


 

Free Add-On: Team System Web Access (TSWA) Power Tool by Microsoft


Microsoft now offers version 2.0 of the Team System Web Access (formerly known as TeamPlain Web Access from DevBiz, which was acquired by Microsoft ) free of charge as a Power Tool with official Microsoft Customer Service support!



TSWA_v2


Download it from here.


Get a detailed list of all improvements here.


Make sure to read the Visual Studio Team System Web Access FAQ.


 

Enable logging to troubleshooting Team System issues

Here’s a list of how to enable logging for the various client and server components of VIsual Studio Team System:


TFS Client (Visual Studio IDE and command line tools):
devenv.exe.config (for Visual Studio IDE), tf.exe.config (for command line tools) as described in Ed Hintz on TFS Client Tracing. If you mainly want to measure performance the web service performance dialog can be added as a trave listener and is very helpful in that case.


Team Foundation Server
You can turn on tracing globally or for specified components only.


Team Foundation Server Activity Logging
Records web service method calls. See here how to enable and here, here and here how to analyze the data.


Team Build Server
Look into the config file for instructions on how to enable tracing, typically found in: %ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\tfsbuildservice.exe.config.


Team Test Load Agent
You can turn on logging in the QTController.exe.config (for the Controller) and QTAgentService.exe.config (for the Agents). More information can be found here.


You might also be interested in other useful logging options for .NET.