<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>stuartpreston.net &#187; Team Foundation Server</title>
	<atom:link href="http://stuartpreston.net/blog/category/team-foundation-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuartpreston.net/blog</link>
	<description>Blog of Stuart Preston</description>
	<lastBuildDate>Thu, 22 Jul 2010 08:08:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple assembly versioning with Team Build 2010</title>
		<link>http://stuartpreston.net/blog/2010/05/02/simple-assembly-versioning-with-team-build-2010/</link>
		<comments>http://stuartpreston.net/blog/2010/05/02/simple-assembly-versioning-with-team-build-2010/#comments</comments>
		<pubDate>Sun, 02 May 2010 22:28:02 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/2010/05/02/simple-assembly-versioning-with-team-build-2010/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>There are <a href="http://www.google.co.uk/#hl=en&amp;source=hp&amp;q=tfs+2010+assembly+versioning&amp;meta=&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=&amp;fp=81e271cb733e4ece">many</a> <a href="http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/11/09/tfs-2010-build-number-and-assembly-file-versions-completely-in-sync-with-only-msbuild-4-0.aspx">more</a> <a href="http://blogs.msdn.com/jimlamb/archive/2010/02/12/How-to-Create-a-Custom-Workflow-Activity-for-TFS-Build-2010.aspx">sophisticated</a> 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:</p>
<p><a href="http://stuartpreston.net/blog/wp-content/uploads/2010/05/image.png"><img style="display: inline; border-width: 0px;" title="image" src="http://stuartpreston.net/blog/wp-content/uploads/2010/05/image_thumb.png" border="0" alt="image" width="613" height="466" /></a></p>
<p>So here’s how I do it.  To start off with I <a href="http://msdn.microsoft.com/en-us/library/dd647547.aspx#parameters_basic">customise the BuildNumber format within my build definition</a>:</p>
<p><a href="http://stuartpreston.net/blog/wp-content/uploads/2010/05/image1.png"><img style="display: inline; border-width: 0px;" title="image" src="http://stuartpreston.net/blog/wp-content/uploads/2010/05/image_thumb1.png" border="0" alt="image" width="407" height="204" /></a></p>
<p>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 href="http://blogs.msdn.com/msbuild/archive/2007/01/03/why-are-build-numbers-limited-to-65535.aspx">a file version number cannot be higher than 65335</a>).</p>
<p>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!</p>
<p>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).</p>
<p>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).</p>
<p>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).</p>
<pre class="code"><span style="color: blue;"><span style="font-family: Consolas;">&lt;</span></span><span style="font-family: Consolas;"><span style="color: #a31515;">UsingTask
    </span><span style="color: red;">TaskName</span><span style="color: blue;">=</span>"<span style="color: blue;">Microsoft.TeamFoundation.Build.Tasks.GetBuildProperties</span>"
    <span style="color: red;">AssemblyFile</span><span style="color: blue;">=</span>"<span style="color: blue;">$(MSBuildProgramFiles32)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.ProcessComponents.dll</span>"
  <span style="color: red;">Condition</span><span style="color: blue;">=</span>"<span style="color: blue;">' $(BuildUri) '!='  '</span>"</span><span style="font-family: Consolas;"><span style="color: blue;">/&gt;

&lt;</span><span style="color: #a31515;">Target </span><span style="color: red;">Name</span><span style="color: blue;">=</span>"<span style="color: blue;">BeforeBuild</span>" <span style="color: red;">Condition</span><span style="color: blue;">=</span>"<span style="color: blue;">' $(BuildUri) '!='  '</span>"</span><span style="font-family: Consolas;"><span style="color: blue;">&gt;
  &lt;</span><span style="color: #a31515;">GetBuildProperties </span><span style="color: red;">TeamFoundationServerUrl</span><span style="color: blue;">=</span>"<span style="color: blue;">$(TeamFoundationServerUrl)</span>" <span style="color: red;">BuildUri</span><span style="color: blue;">=</span>"<span style="color: blue;">$(BuildUri)</span>"</span><span style="font-family: Consolas;"><span style="color: blue;">&gt;
    &lt;</span><span style="color: #a31515;">Output </span><span style="color: red;">TaskParameter</span><span style="color: blue;">=</span>"<span style="color: blue;">BuildNumber</span>" <span style="color: red;">PropertyName</span><span style="color: blue;">=</span>"<span style="color: blue;">BuildNumber</span>" </span><span style="font-family: Consolas;"><span style="color: blue;">/&gt;
  &lt;/</span><span style="color: #a31515;">GetBuildProperties</span></span><span style="font-family: Consolas;"><span style="color: blue;">&gt;

  &lt;</span><span style="color: #a31515;">PropertyGroup</span></span><span style="font-family: Consolas;"><span style="color: blue;">&gt;
    &lt;</span><span style="color: #a31515;">BuildNumberSplitLocation</span><span style="color: blue;">&gt;</span>$([MSBuild]::Add($(BuildNumber.LastIndexOf('_')),1))<span style="color: blue;">&lt;/</span><span style="color: #a31515;">BuildNumberSplitLocation</span></span><span style="font-family: Consolas;"><span style="color: blue;">&gt;
  &lt;/</span><span style="color: #a31515;">PropertyGroup</span></span><span style="font-family: Consolas;"><span style="color: blue;">&gt;

  &lt;</span><span style="color: #a31515;">ItemGroup</span></span><span style="font-family: Consolas;"><span style="color: blue;">&gt;
    &lt;</span><span style="color: #a31515;">AssemblyVersionLines </span><span style="color: red;">Include</span><span style="color: blue;">=</span>"<span style="color: blue;">[assembly:AssemblyFileVersion(</span><span style="color: red;">&amp;quot;</span><span style="color: blue;">$(BuildNumber.Substring($(BuildNumberSplitLocation)))</span><span style="color: red;">&amp;quot;</span><span style="color: blue;">)]</span>" </span><span style="font-family: Consolas;"><span style="color: blue;">/&gt;
  &lt;/</span><span style="color: #a31515;">ItemGroup</span></span><span style="font-family: Consolas;"><span style="color: blue;">&gt;

  &lt;</span><span style="color: #a31515;">Exec </span><span style="color: red;">Command</span><span style="color: blue;">=</span>"<span style="color: blue;">attrib -r </span><span style="color: red;">&amp;quot;</span><span style="color: blue;">$(ProjectDir)\Properties\AssemblyInfo.cs</span><span style="color: red;">&amp;quot;</span>" <span style="color: red;">ContinueOnError</span><span style="color: blue;">=</span>"<span style="color: blue;">false</span>" </span><span style="font-family: Consolas;"><span style="color: blue;">/&gt;
  &lt;</span><span style="color: #a31515;">Message </span><span style="color: red;">Text</span><span style="color: blue;">=</span>"<span style="color: blue;">Lines being added: @(AssemblyVersionLines)</span>" <span style="color: red;">Importance</span><span style="color: blue;">=</span>"<span style="color: blue;">high</span>" </span><span style="font-family: Consolas;"><span style="color: blue;">/&gt;
  &lt;</span><span style="color: #a31515;">WriteLinesToFile </span><span style="color: red;">File</span><span style="color: blue;">=</span>"<span style="color: blue;">$(ProjectDir)\Properties\AssemblyInfo.cs</span>" <span style="color: red;">Lines</span><span style="color: blue;">=</span>"<span style="color: blue;">@(AssemblyVersionLines)</span>" </span><span style="font-family: Consolas;"><span style="color: blue;">/&gt;
&lt;/</span><span style="color: #a31515;">Target</span></span><span style="color: blue;"><span style="font-family: Consolas;">&gt;</span>
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2010/05/02/simple-assembly-versioning-with-team-build-2010/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Enabling Code Coverage in Visual Studio 2010</title>
		<link>http://stuartpreston.net/blog/2010/04/13/enabling-code-coverage-in-visual-studio-2010/</link>
		<comments>http://stuartpreston.net/blog/2010/04/13/enabling-code-coverage-in-visual-studio-2010/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 09:49:26 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/2010/04/13/enabling-code-coverage-in-visual-studio-2010/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>Hopefully this will save someone a minute or two.</p>
<p>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<strong> Data and Diagnostics </strong>where you can then set Code Coverage to enabled by checking the box.</p>
<p><img style="display: inline; border-width: 0px;" title="image" src="http://stuartpreston.net/blog/wp-content/uploads/2010/04/image.png" border="0" alt="image" width="640" height="476" /></p>
<p>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”.</p>
<p>Looks pretty obvious now huh!</p>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2010/04/13/enabling-code-coverage-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Report: 1st UK ALM User Group meeting</title>
		<link>http://stuartpreston.net/blog/2010/02/14/report-1st-uk-alm-user-group-meeting/</link>
		<comments>http://stuartpreston.net/blog/2010/02/14/report-1st-uk-alm-user-group-meeting/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 22:46:50 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[ALM]]></category>
		<category><![CDATA[Application Lifecycle Management]]></category>
		<category><![CDATA[SDLC]]></category>
		<category><![CDATA[Software Development Lifecycle]]></category>
		<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[UKALMUG]]></category>
		<category><![CDATA[UK]]></category>
		<category><![CDATA[User Group]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/2010/02/14/report-1st-uk-alm-user-group-meeting/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>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.  </strong></p>
<p>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.</p>
<p>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.</p>
<p>Some of the wider questions about the group included:<br />
– What is the vehicle for the UK ALM User Group message?<br />
– Should the UK ALM User Group have a “voice”? <br />
– How do we spread the word about ALM and ‘make it stick’. </p>
<p>Lessons learned were that we need to <strong>prioritise the topics</strong> and also <strong>timebox</strong> them!   Hopefully in future sessions this will be easier to achieve.</p>
<p>It was agreed that each member of the group should try and post a session topic to the User Group website (<a href="http://ukalmug.ning.com/forum/topics/discussion-topics-for-uk-alm)">http://ukalmug.ning.com/forum/topics/discussion-topics-for-uk-alm)</a>.  The most popular session topics will be determined and we can then find presenters for them. </p>
<p>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.  <em>If anyone can recommend a bar or other venue in London with presentation facilities then please let me know. </em></p>
<p>Drinks, socialising and continuation of some of the discussions were then had at a local bar…</p>
<p><em>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.</em></p>
<p>Please remember to tag anything related to the user group on twitter with <a href="http://twitter.com/#search?q=%23ukalmug">#ukalmug</a>.  There is also a list of members on twitter at <a href="http://twitter.com/ukalmug/members">@ukalmug/members</a></p>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2010/02/14/report-1st-uk-alm-user-group-meeting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TFS WIT hacks: Setting a DateTime field based on String value in another field</title>
		<link>http://stuartpreston.net/blog/2009/11/09/tfs-wit-hacks-setting-a-datetime-field-based-on-string-value-in-another-field/</link>
		<comments>http://stuartpreston.net/blog/2009/11/09/tfs-wit-hacks-setting-a-datetime-field-based-on-string-value-in-another-field/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 23:48:13 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[TFS]]></category>
		<category><![CDATA[WIT]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/?p=24</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>I recently responded to a question on a Microsoft discussion list.  The question was (paraphrased):</p>
<blockquote><p><em>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.</em></p>
<p><em>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.</em></p></blockquote>
<p>Well I remembered doing something similar during some prototyping on <a href="http://scrumforteamsystem.com">Scrum for Team System</a>.  The initial trap is that when you set up a &lt;COPY from=”clock” /&gt; 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!</p>
<pre class="csharpcode">      <span class="kwrd">&lt;</span><span class="html">FIELD</span> <span class="attr">name</span><span class="kwrd">="FieldA"</span> <span class="attr">refname</span><span class="kwrd">="Playground.FieldA"</span> <span class="attr">type</span><span class="kwrd">="String"</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">COPY</span> <span class="attr">from</span><span class="kwrd">="value"</span> <span class="attr">value</span><span class="kwrd">="No"</span> <span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">ALLOWEDVALUES</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">LISTITEM</span> <span class="attr">value</span><span class="kwrd">="Yes"</span> <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">LISTITEM</span> <span class="attr">value</span><span class="kwrd">="No"</span> <span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">ALLOWEDVALUES</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">FIELD</span><span class="kwrd">&gt;</span>

      <span class="kwrd">&lt;</span><span class="html">FIELD</span> <span class="attr">name</span><span class="kwrd">="FieldB"</span> <span class="attr">refname</span><span class="kwrd">="Playground.FieldB"</span> <span class="attr">type</span><span class="kwrd">="DateTime"</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">WHEN</span> <span class="attr">field</span><span class="kwrd">="Playground.FieldA"</span> <span class="attr">value</span><span class="kwrd">="Yes"</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">COPY</span> <span class="attr">from</span><span class="kwrd">="clock"</span> <span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">WHEN</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">WHEN</span> <span class="attr">field</span><span class="kwrd">="Playground.FieldA"</span> <span class="attr">value</span><span class="kwrd">="No"</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">READONLY</span> <span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">WHEN</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">FIELD</span><span class="kwrd">&gt;</span></pre>
<p>As you can see, the trick is to deliberately set FieldB to &lt;READONLY /&gt; 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:</p>
<p><a href="http://stuartpreston.net/blog/wp-content/uploads/2009/11/clip_image0026.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002[6]" src="http://stuartpreston.net/blog/wp-content/uploads/2009/11/clip_image0026_thumb.jpg" border="0" alt="clip_image002[6]" width="451" height="525" /></a></p>
<p>This sample should work on TFS2005, 2008 and all versions of 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2009/11/09/tfs-wit-hacks-setting-a-datetime-field-based-on-string-value-in-another-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TFS2010 API: Retrieving a list of Process Templates on the server.</title>
		<link>http://stuartpreston.net/blog/2009/11/07/tfs2010-api-retrieving-a-list-of-process-templates-on-the-server/</link>
		<comments>http://stuartpreston.net/blog/2009/11/07/tfs2010-api-retrieving-a-list-of-process-templates-on-the-server/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 16:11:25 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[ALM]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[TFS]]></category>
		<category><![CDATA[TFS2010]]></category>
		<category><![CDATA[TFS2010 Beta 2]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/?p=12</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>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.</p>
<p>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 <em>or</em> 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.</p>
<p>This code will work against TFS2010 Beta 2 but is not guaranteed to work in the RTM.</p>
<pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">using</span> System.Text;
<span class="kwrd">using</span> Microsoft.TeamFoundation.Framework.Client;
<span class="kwrd">using</span> Microsoft.TeamFoundation.Framework.Common;
<span class="kwrd">using</span> Microsoft.TeamFoundation.Client;
<span class="kwrd">using</span> Microsoft.TeamFoundation.Server;

<span class="kwrd">namespace</span> TFSUtils
{
    <span class="kwrd">class</span> Program
    {
        <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)
        {
            <span class="rem">//replace this with the URL to your TFS instance.</span>
            Uri tfsUri = <span class="kwrd">new</span> Uri(<span class="str">"http://sptfs02:8080/tfs"</span>);

            TeamFoundationApplicationInstance tfai = <span class="kwrd">new</span> TeamFoundationApplicationInstance(tfsUri, <span class="kwrd">new</span> UICredentialsProvider());
            tfai.EnsureAuthenticated();

            ITeamProjectCollectionService collectionService = tfai.GetService&lt;ITeamProjectCollectionService&gt;();
            IList&lt;TeamProjectCollection&gt; collections = collectionService.GetCollections();

            <span class="kwrd">foreach</span> (TeamProjectCollection collection <span class="kwrd">in</span> collections)
            {
                <span class="kwrd">if</span> (collection.State == TeamFoundationServiceHostStatus.Started)
                {
                    Console.WriteLine(String.Format(<span class="str">"\nCollection: {0}"</span>, collection.Name));
                    IProcessTemplates processTemplates = tfai.GetTeamFoundationServer(collection.Id).GetService&lt;IProcessTemplates&gt;();
                    TemplateHeader[] templateHeaders = processTemplates.TemplateHeaders();
                    <span class="kwrd">foreach</span> (TemplateHeader header <span class="kwrd">in</span> templateHeaders)
                    {
                        Console.WriteLine(String.Format(<span class="str">"\t{0} {1}"</span>, header.TemplateId, header.Name));
                    }
                }
            }

            Console.WriteLine(<span class="str">"\nPress any key to continue."</span>);
            Console.ReadKey();
        }
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2009/11/07/tfs2010-api-retrieving-a-list-of-process-templates-on-the-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>See you at PDC 2009?</title>
		<link>http://stuartpreston.net/blog/2009/10/23/see-you-at-pdc-2009/</link>
		<comments>http://stuartpreston.net/blog/2009/10/23/see-you-at-pdc-2009/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 15:48:49 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/2009/10/23/see-you-at-pdc-2009/</guid>
		<description><![CDATA[I will be presenting at Microsoft PDC 2009 along with Simon Bennett from EMC Consulting on Scrum for Microsoft Visual Studio Team System.
It will be very weird presenting with an ex-colleague and seeing a few folk I used to work with, but I’m looking forward to it and meeting all sorts of interesting people with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://microsoftpdc.com"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://stuartpreston.net/blog/wp-content/uploads/2009/10/image.png" width="180" height="240" /></a>I will be presenting at <a href="http://microsoftpdc.com/">Microsoft PDC 2009</a> along with <a href="http://consultingblogs.emc.com/simonbennett">Simon Bennett</a> from <a href="http://www.emc.com/consulting">EMC Consulting</a> on <a href="http://microsoftpdc.com/Sessions/FT09">Scrum for Microsoft Visual Studio Team System</a>.</p>
<p>It will be very weird presenting with an ex-colleague and seeing a few folk I used to work with, but I’m looking forward to it and meeting all sorts of interesting people with stories to tell about their experience with the <a href="http://scrumforteamsystem.com">Scrum for Team System</a> process template (I worked on this since the first Beta of Team Foundation Server 2005 right up to when I left EMC last month).</p>
<p>We’re going to do a drill down into the new features that have been implemented in the latest version that is compatible with Visual Studio 2010 Team Foundation Server Beta 2, and share our experience of extending Team Foundation Server.</p>
<p>Look forward to seeing some of you there!</p>
<p>PS: There’s still a $300 discount if you register before the end of October.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2009/10/23/see-you-at-pdc-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New blog site</title>
		<link>http://stuartpreston.net/blog/2009/10/13/new-blog-site/</link>
		<comments>http://stuartpreston.net/blog/2009/10/13/new-blog-site/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 17:42:29 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Team Foundation Server]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/?p=6</guid>
		<description><![CDATA[Welcome to my new home on the web.&#160; I’ve been blogging for over 5 years at http://consultingblogs.emc.com/stuartpreston and will aim to continue here and keep those permalinks permanent.
I’m sure the range of topics on here will vary but for now will mostly be around Team Foundation Server, Application Lifecycle Management and life as an ex-CTO [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to my new home on the web.&#160; I’ve been blogging for over 5 years at <a href="http://consultingblogs.emc.com/stuartpreston">http://consultingblogs.emc.com/stuartpreston</a> and will aim to continue here and keep those permalinks permanent.</p>
<p>I’m sure the range of topics on here will vary but for now will mostly be around Team Foundation Server, Application Lifecycle Management and life as an ex-CTO :)&#160; Yes as it’s my own blog I’ll be mixing some of my personal observations on life in with the work stuff too…</p>
<p>If you followed me here from my last blog at EMC Consulting and just want the new feed address, it is: <a title="http://stuartpreston.net/blog/?feed=rss2" href="http://stuartpreston.net/blog/?feed=rss2">http://stuartpreston.net/blog/?feed=rss2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2009/10/13/new-blog-site/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
