Posted by Stuart Preston on October 23, 2011 under ALM, Application Lifecycle Management, UKALMUG |
Has been a long time since I posted on here (sign of the times I think, most of my updates are relegated to 140 characters these days). I’ve been very busy in the UK, India and other countries helping a very large company get a hold of their deployment engineering practices as part of an ALM overhaul.
It’s nearly November and RippleRock are sponsoring the ALM Summit in Redmond. If you are and you’re from the UK, drop me a note in the comments – we might even organise a mini UK ALM User Group over a beer whilst we are out there…
Posted by Stuart Preston on July 21, 2010 under Uncategorized |
Only applies if you are in a non-US locale.
Working through a Visual Studio Scrum implementation on a client site at the moment we noticed there seems to be a date format bug in the Sprint Burndown report in Visual Studio Scrum 1.0 RTW if you are in a non US locale. This prevents the current sprint bring calculated and the report falls over with an error:
Query execution failed for dataset ‘dsSprintsCurrent’. (rsErrorExecutingCommand)
The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
My fix is in the RDL and to replace the line:
DECLARE @Tomorrow DATE = CONVERT(DATE, DATEADD(day, 1, @Today)
with
DECLARE @Tomorrow DATE = CONVERT(DATE, DATEADD(day, 1, CONVERT(DATE, @Today, 103)))
No doubt there will be an update at some point but thought put up this information to help anyone who has this issue.
Update (22nd July 2010): The official fix revolves around the data type of the “Today” parameter in the report which is incorrectly set to a string:
<ReportParameter Name="Today">
<DataType>DateTime</DataType>
<DefaultValue>
<Values>
<Value>=today</Value>
</Values>
</DefaultValue>
<Hidden>true</Hidden>
</ReportParameter>
Posted by Stuart Preston on June 16, 2010 under Uncategorized |
After all the effort put in to setting up a vote for the date of the 2nd UK ALM User Group meeting on 23rd June 2010, I am regretfully going to have to postpone it again.
Firstly there is some football match* on Wednesday afternoon and this has limited the choice of venue somewhat (and probably attendance), secondly it is necessary for me to be on a client site on Wednesday and it is out of town so I cannot even guarantee my attendance.
This is certainly not the way we planned things, I would be grateful for anyone who can step forward and help co-ordinate the London end of things jointly with me so we have some resilience in future. Any suggestions for a venue with a projector (not showing the football!), tables, WiFi (am I just dreaming now?) and a bar gratefully received.
We had a few presenters lined up for this session as well as a raffle for a Pluralsight On Demand subscription and I apologise to them especially and hope we can reschedule all of this asap.
Finally, i’m compiling a twitter list (@ukalmug/members) with everyone who wants to participate so we can follow each other – please can you send me your twitter ID and I will add it.
Thanks, Stuart.
Stuart Preston
UK ALM User Group Coordinator, http://almug.org
@StuartPreston @ukalmug
(* Can you tell I’m not a big football fan?)
Posted by Stuart Preston on May 18, 2010 under Development Practices, Visual Studio |
This post generated some interest on a discussion list so I’m re-posting here on my blog. Cutting a longer story short, the original poster wanted a way to start a process as Network Service rather than as the current Windows identity to mitigate the risk that you have more rights than you should have.
For those who have tried to use “runas” to achieve this you are left with the rather bleak message: “RUNAS ERROR: Unable to acquire user password”.

I’ll skip the reasons for this and go straight onto the solution. Create a dummy service using the Service Manager (sc.exe). This launches the application in the right session and is allowed to run as Network Service or even Local System (NT Authority\Local System).
@echo off
sc delete NetworkServiceCmd >nul:
sc create NetworkServiceCmd binpath= “cmd /K start c:\neverendingapp.exe” obj= “NT Authority\Network Service” >nul:
sc start NetworkServiceCmd >nul:
sc delete NetworkServiceCmd >nul:
Simply drop the above into a batch file and run it. You can then use “Attach to Process” in Visual Studio to attach to the process (don’t forget that your PDB’s must be in the same location as the assembly).

Here’s a screenshot of the debugger attached to my “NeverEndingApp” and viewing the current identity.

You need to manually kill off the process you started, you can use Task Manager as usual or here’s a macro I use that works in my scenario. You can attach this to a Keyboard Shortcut or even a Toolbar.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module TerminateProcess
Public Function TerminateProcess()
Dim processes As EnvDTE.Processes = DTE.Debugger.LocalProcesses
Dim process As EnvDTE.Process
For Each process In processes
If (process.Name.ToLower().Contains(“neverendingapp.exe”)) Then
process.Terminate(True)
End If
Next
End Function
End Module
I’m certain all the above can be improved on but I think all the basics are in here and customising it for your process is a challenge I’ll leave to the reader!
Posted by Stuart Preston on May 2, 2010 under Team Foundation Server |
There are many more sophisticated ways of achieving this but none seemed to give me exactly what I wanted, so here I present yet another way of doing assembly versioning with Team Build 2010. I wanted my Team Build number to exactly match that of my assembly versions (and not be derived), like this:

So here’s how I do it. To start off with I customise the BuildNumber format within my build definition:

In my case, I decided to customise it so that the Major and Minor version numbers “0.1” were added explicitly. This lets me control the first two parts of the version number which is what I want to achieve. I also added the macros $(Month)$(DayOfMonth) with a 1 in front of it. For the 2nd May 2010 this would generate a number 10502. (The reason I don’t use the full year here is that for today it would generate a build number of 100502 and a file version number cannot be higher than 65335).
When I decide to work on version 0.2, 0.3 or 1.0 all I have to do is increment the Build Number here and save the definition, I’m also happy to increment the number when the year changes. I said it was simple!
The final part of the build number format was left as-is (i.e. the Revision number that increments by 1 with each build on that day and resets for the next day).
Now all we need to do is retrieve this version number when MSBuild is run against the solution, split the version number and take the numeric portion into the Properties\AssemblyVersion.cs file (you will need to comment out the AssemblyFileVersion line in that file first and check it in).
Here’s the fragment that you’ll need to insert in your .csproj file (you’ll have to check it out then open it in Notepad or your favourite text editor).
<UsingTask
TaskName="Microsoft.TeamFoundation.Build.Tasks.GetBuildProperties"
AssemblyFile="$(MSBuildProgramFiles32)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.ProcessComponents.dll"
Condition="' $(BuildUri) '!=' '"/>
<Target Name="BeforeBuild" Condition="' $(BuildUri) '!=' '">
<GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)">
<Output TaskParameter="BuildNumber" PropertyName="BuildNumber" />
</GetBuildProperties>
<PropertyGroup>
<BuildNumberSplitLocation>$([MSBuild]::Add($(BuildNumber.LastIndexOf('_')),1))</BuildNumberSplitLocation>
</PropertyGroup>
<ItemGroup>
<AssemblyVersionLines Include="[assembly:AssemblyFileVersion("$(BuildNumber.Substring($(BuildNumberSplitLocation)))")]" />
</ItemGroup>
<Exec Command="attrib -r "$(ProjectDir)\Properties\AssemblyInfo.cs"" ContinueOnError="false" />
<Message Text="Lines being added: @(AssemblyVersionLines)" Importance="high" />
<WriteLinesToFile File="$(ProjectDir)\Properties\AssemblyInfo.cs" Lines="@(AssemblyVersionLines)" />
</Target>
Posted by Stuart Preston on April 13, 2010 under Team Foundation Server |
Hopefully this will save someone a minute or two.
In Visual Studio 2010 to enable Code Coverage, you edit the .TestSettings file (e.g. Local.TestSettings) – similar to the TestRunConfig file in Visual Studio 2008. Code Coverage no longer has its own section – it can be found under Data and Diagnostics where you can then set Code Coverage to enabled by checking the box.

The subtle thing I missed for a couple of minutes was that the Configure button at the top of the grid only is enabled when you select the Code Coverage row – and in there is the Code Coverage Detail dialog that lets you select the “artifacts to instrument”.
Looks pretty obvious now huh!
Posted by Stuart Preston on February 14, 2010 under ALM, Application Lifecycle Management, SDLC, Software Development Lifecycle, Team Foundation Server, UKALMUG |
The inaugural meeting of the UK ALM User Group was held on Thursday 11th February at Microsoft’s Cardinal Place offices near Victoria in London.
The session was deliberately left with an open agenda, and after we had made our introductions we shared many anecdotes from our collective experiences with ALM, the discussion on the day mainly focusing around people and process rather than the tools.
As the majority of people in the meeting were practitioners using Microsoft ALM tooling – there was widespread support for bringing in presenters on non-Microsoft ALM tools to ensure that the group kept abreast of the latest developments.
Some of the wider questions about the group included:
– What is the vehicle for the UK ALM User Group message?
– Should the UK ALM User Group have a “voice”?
– How do we spread the word about ALM and ‘make it stick’.
Lessons learned were that we need to prioritise the topics and also timebox them! Hopefully in future sessions this will be easier to achieve.
It was agreed that each member of the group should try and post a session topic to the User Group website (http://ukalmug.ning.com/forum/topics/discussion-topics-for-uk-alm). The most popular session topics will be determined and we can then find presenters for them.
There was also broad support for having the UK ALM User Group more regularly than the initially proposed (quarterly). More details on this will follow soon. If anyone can recommend a bar or other venue in London with presentation facilities then please let me know.
Drinks, socialising and continuation of some of the discussions were then had at a local bar…
Thanks to Microsoft for providing the venue and for the enthusiastic attendees some of whom had travelled from out of London to come to the meeting. Hope to see all of you and more at the next meeting.
Please remember to tag anything related to the user group on twitter with #ukalmug. There is also a list of members on twitter at @ukalmug/members
Posted by Stuart Preston on January 13, 2010 under ALM, Application Lifecycle Management, SDLC, Software Development Lifecycle, UKALMUG |
This post is to announce the UK ALM User Group that I have created. This has been a personal objective of mine for some time and I have decided that now is as good a time as any to actually make it happen!
The UK ALM User Group is for practitioners of Application Lifecycle Management (ALM) and Software Development Lifecycle (SDLC) in the UK to get together and discuss and share ideas, tools and techniques, as well as to socialise somewhere other than Agile and Software Development conferences!
Initially we plan to meet quarterly, the first dates are already lined up for February and May. Membership is free and we have some venues in mind in London to visit to start off with – not to say that if there is enough interest those of us in the south will travel to other UK locations too!
ALM Practitioners and enthusiasts from all technical disciplines are welcome – we’re an agnostic bunch!
To sign up, visit: http://almug.org and join in the discussion – especially welcome are presenters for our first meeting planned for February 11th 2010.
Hope to see some of you there!

Posted by Stuart Preston on November 9, 2009 under Team Foundation Server |
I recently responded to a question on a Microsoft discussion list. The question was (paraphrased):
I need to get the clock value assigned to “Field B” when the value of “Field A” is changed to a specific value. Field A allows Yes, No values only.
I need the exact time “Field A” gets assigned Yes. When it goes back to No, I must not do anything with the value stored in “Field B”. Then if “Field A” gets assigned Yes one more time, I need “Field B” updated with the DateTime of when this assignment happened and not losing the value until next time field A gets triggered to Yes.
Well I remembered doing something similar during some prototyping on Scrum for Team System. The initial trap is that when you set up a <COPY from=”clock” /> rule on a TFS WIT field, then Team Explorer refreshed this time after the work item is saved. This is not the behaviour we wanted to see. After a bit of experimentation, success!
<FIELD name="FieldA" refname="Playground.FieldA" type="String">
<COPY from="value" value="No" />
<ALLOWEDVALUES>
<LISTITEM value="Yes" />
<LISTITEM value="No" />
</ALLOWEDVALUES>
</FIELD>
<FIELD name="FieldB" refname="Playground.FieldB" type="DateTime">
<WHEN field="Playground.FieldA" value="Yes">
<COPY from="clock" />
</WHEN>
<WHEN field="Playground.FieldA" value="No">
<READONLY />
</WHEN>
</FIELD>
As you can see, the trick is to deliberately set FieldB to <READONLY /> when FieldA is “No”. I thought I’d post this here in case anyone else needs to do something similar. A view of the history on the Work Item I edited confirms the modification works as required:
![clip_image002[6] clip_image002[6]](http://stuartpreston.net/blog/wp-content/uploads/2009/11/clip_image0026_thumb.jpg)
This sample should work on TFS2005, 2008 and all versions of 2010.
Posted by Stuart Preston on November 7, 2009 under Team Foundation Server |
I thought I’d post some utility code that I’ve been playing with to retrieve information about the Process Templates available on a TFS 2010 instance.
As you can see from the code, each TeamProjectCollection has its own store of Process Templates (in TFS 2008 there was in effect a single “Project Collection”) so we need to look through each collection to retrieve the templates that have been uploaded to it.
You’ll need references to Microsoft.TeamFoundation.dll, Microsoft.TeamFoundation.Client.dll, Microsoft.TeamFoundation.Common.dll. On a machine with Visual Studio 2010 installed they should be found in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0 or C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0 depending on whether you have a 64-bit version of Windows or not. You’ll also need to set the Target Framework to .NET Framework 3.5 as the assemblies required are in the v2 GAC.
This code will work against TFS2010 Beta 2 but is not guaranteed to work in the RTM.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Framework.Common;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Server;
namespace TFSUtils
{
class Program
{
static void Main(string[] args)
{
//replace this with the URL to your TFS instance.
Uri tfsUri = new Uri("http://sptfs02:8080/tfs");
TeamFoundationApplicationInstance tfai = new TeamFoundationApplicationInstance(tfsUri, new UICredentialsProvider());
tfai.EnsureAuthenticated();
ITeamProjectCollectionService collectionService = tfai.GetService<ITeamProjectCollectionService>();
IList<TeamProjectCollection> collections = collectionService.GetCollections();
foreach (TeamProjectCollection collection in collections)
{
if (collection.State == TeamFoundationServiceHostStatus.Started)
{
Console.WriteLine(String.Format("\nCollection: {0}", collection.Name));
IProcessTemplates processTemplates = tfai.GetTeamFoundationServer(collection.Id).GetService<IProcessTemplates>();
TemplateHeader[] templateHeaders = processTemplates.TemplateHeaders();
foreach (TemplateHeader header in templateHeaders)
{
Console.WriteLine(String.Format("\t{0} {1}", header.TemplateId, header.Name));
}
}
}
Console.WriteLine("\nPress any key to continue.");
Console.ReadKey();
}
}
}