Search This Blog

Wednesday, November 29, 2006

Another Terminals Version

Again, we have published a new Terminals version. This time we've added a cool feature called: Desktop Share. With this feature you can define a share (should be to your desktop) on the terminal server. When you drag and drop files to your terminal server window those files will be copied to that share. It's a little trick to support easy file copy to the server. If you would like to enable copy and paste of files between the client and the server you can read: HOW TO: Securely Copy and Paste Files Between the Terminal Services Client and the Terminal Server in Windows 2000.

Tuesday, November 28, 2006

XPath Nested Queries

Xml XPath queries are not so straight forward and each time I'm using them I struggle it.

On one of our inside tools I needed to parse an Xml file but the selected nodes were reflected from their value and not from their name only. I was used to have a SelectSingleNode(nodeName) or SelectNodes(nodeName) that did the job for me but now I needed something else.

Here's an example of the Xml:

            <Field Name="Name" Value="object1"/>
            <Field Name="Type" Value="int"/>
            <Field Name="Value" Value="1"/>
            <Field Name="Name" Value="object2"/>
            <Field Name="Type" Value="int"/>
            <Field Name="Value" Value="2"/>
            <Field Name="Name" Value="object3"/>
            <Field Name="Type" Value="string"/>
            <Field Name="Value" Value="aaa"/>
            <Field Name="Name" Value="object4"/>
            <Field Name="Type" Value="string"/>
            <Field Name="Value" Value="bbb"/>
            <Field Name="Name" Value="object5"/>
            <Field Name="Type" Value="int"/>
            <Field Name="Value" Value="3"/>

Now, I would like to select all <Field> nodes that are from type int. So I need to write query that will find all <Field> nodes that have "Name" attribute with the value "Type" and "Value" attribute with the value "int".

Here's how the query should look when you are using XmlDocument.SelectNodes or XmlDocument.SelectSingleNode:


Now, how do I select all the <Row> nodes that correspond to this query? I've tried and found out that a nested query actually works...


Xml XPath queried can be very powerful.

Terminals New Version

I have posted before about this tool and now it has a new version.

We fixed some bugs and added these features:
1) Order toolbar buttons
2) Remote server port selection
3) Remote sounds
4) Connect automatically to local devices (Disk drives, printers, serial ports)

You can download it here:

Sunday, November 12, 2006

How to Get a List of Build Statuses

I have a TFS build installer utility that uses the BuildStore interface to get list of available fields to install. I wanted to filter the list with the build status field but did not find a function that returns the list so using Reflector I found out the the statuses are inside a class named BuildStatus. This class contains a list of public, static, string properties that each one of them represents a build status. The real string value of the build status property is stored in a resource named BuildTypeResource.

So in order to get the list of build statuses I wrote this method:

public static string[] GetBuildStatuses()
Type t = typeof(Microsoft.TeamFoundation.Build.Common.BuildConstants.BuildStatus);
ArrayList constants = new ArrayList();
PropertyInfo[] propertyInfos = t.GetProperties(BindingFlags.Public | BindingFlags.Static |
List<string> buildStatuses = new List<string>();
foreach (PropertyInfo propertyInfo in propertyInfos)
if (propertyInfo.PropertyType == typeof(string))
buildStatuses.Add(propertyInfo.GetValue(null, new object[] { }).ToString());
return buildStatuses.ToArray();

The method uses reflection in order to go through all the properties of the class and retrive their values. The result list will return:

"Build Initializing", "Getting Sources", "Sync Completed", "Compilation Started", "Compilation Completed", "Testing Started", "Testing Completed", "Successfully Completed", "Failed", "Stopped".

Thursday, November 09, 2006

I'm working in a company that develops on demand project management application. You can take a look at our web site: and register to the beta which will be released at Q1 2007.

You can read some interesting stuff from our CEO regarding Clarizen, SaaS and project management here:

Of course our development platform for this project is Microsoft Visual Studio Team System. I look forward to integrate both systems (Clarizen and Team System) to have a complete development process.

Tuesday, November 07, 2006

How to Get Build Types List

There's no method in TFS API that retrieves a list of build types for a project. I looked inside the BuildStore interface and found nothing. Later I saw somewhere that it is not exposed so I wrote my own implementation using source control API. I'm retrieving a list of folders under the TeamBuildTypes folder.

using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;

public string[] GetBuildTypes(string serverName, string teamProject)
TeamFoundationServer tfs = new TeamFoundationServer(serverName, CredentialCache.DefaultCredentials);
VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
ItemSet itemSet = vcs.GetItems("$/" + teamProject + "/TeamBuildTypes", VersionSpec.Latest, RecursionType.OneLevel, DeletedState.NonDeleted, ItemType.Folder);
List<string> buildTypes = new List<string>();
foreach (Item item in itemSet.Items)
string buildType = Path.GetFileName(item.ServerItem);
if (buildType != "TeamBuildTypes")
return buildTypes.ToArray();

Deploymnet Items Not Copied During Build

We had a problem when we've integrated the tests into the build process.
In the TestRunConfig file (.testrunconfig) you can configure deployment items to be copied into the test run directory. The thing is that Visual Studio stores the path with ending backslash and because of annoying bug the deployment items are not copied during the TFS build. This does not happen while working inside Visual Studio environment.
The solution was to open the file in a text editor and remove the ending backslash from all the deployment items. We also removed write permissions from this file so nobody will recreate the problematic paths in the file.

Monday, November 06, 2006

Build's Relevant Associated Changesets using LabelQueryScope

We're working with 2 branches and performing builds on each one of them. Today we've noticed that in the "Associated changests" list we see changsets from both branches. A little investigation of the "Microsoft.TeamFoundation.Build.targets" file we found that you can override a property named "LabelQueryScope" to make the build process only changesets from a specific branch. So in this case if you have a project with 2 sub branches than you need to set the "LabelQueryScope" property with "@$/$(TeamProject)/Branch".
By changing this property you also change the labeled branch of the build.

Sunday, November 05, 2006


I know I haven't written for a while. I'm still trying to get used to the idea of blogging.
I've created a new project in CodePlex named Terminals. If you use Remote Desktop Connection to connect to terminal servers/desktops then you would probably like this tool. It's a multi tab remote desktop connection IDE with lots of cool features written, of course, in C#. My partner to this project is Eyal Post one of the greatest toolsmiths mankind has known who has provided us VSSConverter GUI. BTW, CodePlex is a great place to find and join TFS related projects. The cool part is that you actually use TFS to store your projects source files and work items.