<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>nickhoggard</title>
	<atom:link href="http://nickhoggard.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nickhoggard.wordpress.com</link>
	<description>Technology. Process. Quality.</description>
	<lastBuildDate>Thu, 26 Jan 2012 10:11:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='nickhoggard.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>nickhoggard</title>
		<link>http://nickhoggard.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://nickhoggard.wordpress.com/osd.xml" title="nickhoggard" />
	<atom:link rel='hub' href='http://nickhoggard.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Programmatically finding a Stored Query Definition within TFS2010</title>
		<link>http://nickhoggard.wordpress.com/2011/11/13/programmatically-finding-a-stored-query-definition-within-tfs2010/</link>
		<comments>http://nickhoggard.wordpress.com/2011/11/13/programmatically-finding-a-stored-query-definition-within-tfs2010/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 05:53:46 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[QueryDefinition]]></category>
		<category><![CDATA[Team Foundation Server 2010]]></category>
		<category><![CDATA[TFS 2010]]></category>
		<category><![CDATA[TFS Stored Query]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=132</guid>
		<description><![CDATA[Today I&#8217;m building a small utility and have a requirement to execute a stored work item query from within Team Foundation Server 2010. Previously I&#8217;d used the StoredQueries collection on the Project instance to find a query by name … however it would appear that this was depreciated as part of the TFS2010 release. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=132&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;m building a small utility and have a requirement to execute a stored work item query from within Team Foundation Server 2010. Previously I&#8217;d used the StoredQueries collection on the Project instance to find a query by name … however it would appear that this was depreciated as part of the TFS2010 release.</p>
<p>I was surprised to find that there doesn&#8217;t seem to be a simple replacement for finding a specified stored query by name &#8211; part of me thinks I must be missing a simpler solution, however if anyone else is encountering the same issue I hope that the following code snippet will be of use.</p>
<p>Required namespaces:</p>
<ul>
<li>Microsoft.TeamFoundation.Client</li>
<li>Microsoft.TeamFoundation.WorkItemTracking.Client</li>
</ul>
<p><span style="color:gray;font-family:Consolas;font-size:9pt;">/// <span style="color:green;"><span style="color:gray;">&lt;summary&gt;</span></span></span><br />
///<span style="color:green;"><span style="color:gray;"> &lt;para&gt;<span style="color:green;">Find the TFS QueryDefinition for a specified Team Project<span style="color:gray;">&lt;/para&gt;</span></span></span></span><br />
///<span style="color:green;"> <span style="color:gray;">&lt;para&gt;<span style="color:green;">Note that if multiple queries match the requested queryName</span></span></span><br />
///<span style="color:green;"> only the first will be used<span style="color:gray;">&lt;/para&gt;</span></span><br />
///<span style="color:green;"><span style="color:gray;"> &lt;/summary&gt;</span></span><br />
///<span style="color:green;"><span style="color:gray;"> &lt;param name=&#8221;tfsUrl&#8221;&gt;<span style="color:green;">URL to the TFS project, including the<br />
/// collection name (Eg, http://tfsserver:8080/tfs/DefaultCollection)<span style="color:gray;">&lt;/param&gt;</span></span></span></span><br />
///<span style="color:green;"><span style="color:gray;"> &lt;param name=&#8221;projectName&#8221;&gt;<span style="color:green;">Name of TFS Team Project<span style="color:gray;">&lt;/param&gt;</span></span></span></span><br />
///<span style="color:green;"><span style="color:gray;"> &lt;param name=&#8221;queryName&#8221;&gt;<span style="color:green;">Name of Stored Query. Note if multiple<br />
/// exist the first found will be used<span style="color:gray;">&lt;/param&gt;</span></span></span></span><br />
///<span style="color:green;"><span style="color:gray;"> &lt;returns&gt;&lt;/returns&gt;</span></span><br />
public<span style="color:blue;"> static</span><span style="color:#2b91af;"> QueryDefinition</span> FindQueryItem(<span style="color:blue;">string</span> tfsUrl, <span style="color:blue;">string</span> projectName, <span style="color:blue;">string</span> queryName)<br />
{</p>
<div style="padding-left:20px;">
<p><span style="font-family:Consolas;font-size:9pt;"><span style="color:green;">// Setup the connection to TFS</span></span><br />
TfsTeamProjectCollectionprojectCollection = <span style="color:#2b91af;">TfsTeamProjectCollectionFactory</span>.GetTeamProjectCollection(<span style="color:blue;">new</span><span style="color:#2b91af;"> Uri</span>(tfsUrl));</p>
<p><span style="color:#2b91af;">WorkItemStore</span> workItemStore = projectCollection.GetService&lt;<span style="color:#2b91af;">WorkItemStore</span>&gt;();</p>
<p><span style="color:#2b91af;">Project</span> project = workItemStore.Projects[projectName];</p>
<p><span style="color:blue;">return</span> FindQueryItem(queryName, project.QueryHierarchy);</p>
</div>
<p><span style="font-family:Consolas;font-size:9pt;">}</span></p>
<p><span style="color:gray;font-family:Consolas;font-size:9pt;">///<span style="color:green;"><span style="color:gray;">&lt;summary&gt;</span></span></span><br />
///<span style="color:green;"> Recursively find the QueryDefinition based on the requested queryName.</span><br />
///<span style="color:green;"><span style="color:gray;">&lt;para&gt;<span style="color:green;">Note that if multiple queries match the requested queryName</span></span></span><br />
///<span style="color:green;"> only the first will be used<span style="color:gray;">&lt;/para&gt;</span></span><br />
///<span style="color:green;"><span style="color:gray;">&lt;/summary&gt;</span></span><br />
///<span style="color:green;"><span style="color:gray;">&lt;param name=&#8221;queryName&#8221;&gt;<span style="color:green;">Name of Stored Query. Note if multiple exist<br />
/// the first found will be used<span style="color:gray;">&lt;/param&gt;</span></span></span></span><br />
///<span style="color:green;"><span style="color:gray;">&lt;param name=&#8221;currentNode&#8221;&gt;<span style="color:green;">Pointer to the current node in the recursive search<span style="color:gray;">&lt;/param&gt;</span></span></span></span><br />
///<span style="color:green;"><span style="color:gray;">&lt;returns&gt;<span style="color:green;">QueryDefinition<span style="color:gray;">&lt;/returns&gt;</span></span></span></span><br />
private<span style="color:blue;"> static</span><span style="color:#2b91af;"> QueryDefinition</span> FindQueryItem(<span style="color:blue;">string</span> queryName, <span style="color:#2b91af;">QueryItem</span> currentNode)</p>
<p>{</p>
<p style="padding-left:30px;"><span style="font-family:Consolas;font-size:9pt;"><span style="color:green;">// Attempt to cast to a QueryDefinition</span></span><br />
QueryDefinitionqueryDefinition = currentNode <span style="color:blue;">as</span><span style="color:#2b91af;"> QueryDefinition</span>;</p>
<p style="padding-left:30px;"><span style="color:green;">// Check if we&#8217;ve found a match</span><span style="color:blue;"><br />
if</span> (queryDefinition != <span style="color:blue;">null</span> &amp;&amp; queryDefinition.Name == queryName)</p>
<p style="padding-left:60px;"><span style="font-family:Consolas;font-size:9pt;"><span style="color:blue;">return</span> queryDefinition;</span></p>
<p style="padding-left:30px;"><span style="font-family:Consolas;font-size:9pt;"><span style="color:green;">// Attempt to cast the current node to a QueryFolder</span></span><span style="color:#2b91af;"><br />
QueryFolder</span> queryFolder = currentNode <span style="color:blue;">as</span><span style="color:#2b91af;"> QueryFolder</span>;<span style="color:green;"><br />
</span></p>
<p style="padding-left:30px;"><span style="color:green;">// All further checks are for child nodes so if this is not an<br />
// instance of QueryFolder then no further processing is required.</span><span style="color:blue;"><br />
if</span> (queryFolder == <span style="color:blue;">null</span>)</p>
<p style="padding-left:60px;"><span style="color:blue;">return</span> <span style="color:blue;">null</span>;</p>
<p style="padding-left:30px;"><span style="font-family:Consolas;font-size:9pt;"><span style="color:green;">// Loop through all the child query item<br />
</span></span><span style="color:blue;">foreach</span> (<span style="color:#2b91af;">QueryItem</span> qi <span style="color:blue;">in</span> queryFolder)<br />
{</p>
<p style="padding-left:60px;"><span style="font-family:Consolas;font-size:9pt;"><span style="color:green;">// Recursively call FindQueryItem</span></span><span style="color:#2b91af;"><br />
QueryDefinition</span> ret = FindQueryItem(queryName, qi);</p>
<p style="padding-left:60px;"><span style="color:green;">// If a match is found no further checks are required</span><span style="color:blue;"><br />
if</span> (ret != <span style="color:blue;">null</span>)</p>
<p style="padding-left:90px;"><span style="color:blue;">return</span> ret;</p>
<p style="padding-left:30px;"><span style="font-family:Consolas;font-size:9pt;">}</span></p>
<p style="padding-left:30px;"><span style="color:blue;">return</span> <span style="color:blue;">null</span>;</p>
<p>}</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/132/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=132&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2011/11/13/programmatically-finding-a-stored-query-definition-within-tfs2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>
	</item>
		<item>
		<title>BizTalk 2006 and Versioning GAC’d Dependencies</title>
		<link>http://nickhoggard.wordpress.com/2011/06/02/biztalk-2006-and-versioning-gac%e2%80%99d-dependencies/</link>
		<comments>http://nickhoggard.wordpress.com/2011/06/02/biztalk-2006-and-versioning-gac%e2%80%99d-dependencies/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 00:23:28 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[BizTalk 2006]]></category>
		<category><![CDATA[Deployment Process]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[Versioning GAC Assemblies]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=126</guid>
		<description><![CDATA[Overview Recently I found myself working on a BizTalk 2006 project that had been pre-configured to use a number of referenced assemblies that ultimately would be deployed to the GAC on the target BizTalk machine. Unfortunately I found that managing the versions and deployments of this configuration to be &#8216;problematic&#8217; at best, so I&#8217;ve been [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=126&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Overview</h2>
<p>Recently I found myself working on a BizTalk 2006 project that had been pre-configured to use a number of referenced assemblies that ultimately would be deployed to the GAC on the target BizTalk machine. Unfortunately I found that managing the versions and deployments of this configuration to be &#8216;problematic&#8217; at best, so I&#8217;ve been giving some thought to how this might be done differently.</p>
<p>My basic requirements for this process are as follows:</p>
<ul>
<li>The process <strong>must</strong> allow for assemblies built in a separate solution</li>
<li>The process <strong>must</strong> be easy for developers</li>
<li>All environments (including developers machines) <strong>must</strong> be installed the same way</li>
<li>Deployed assemblies <strong>must</strong> be versioned</li>
</ul>
<p>This post describes how I went about achieving these goals – though I&#8217;m sure there must be other ways to do this as well.</p>
<h2>Setting up the new Development / Deployment Process</h2>
<h3>Step 1 – Create a new Setup project</h3>
<p>Create a new Visual Studio Installer project within your solution, and configure the following properties (along with any others you may feel you want to change).</p>
<div>
<table style="border-collapse:collapse;" border="0">
<col style="width:213px;" />
<col style="width:306px;" />
<tbody valign="top">
<tr style="background:#d9d9d9;">
<td style="padding-left:7px;padding-right:7px;border:solid .5pt;">Property</td>
<td style="padding-left:7px;padding-right:7px;border-top:solid .5pt;border-left:none;border-bottom:solid .5pt;border-right:solid .5pt;">Value</td>
</tr>
<tr>
<td style="padding-left:7px;padding-right:7px;border-top:none;border-left:solid .5pt;border-bottom:solid .5pt;border-right:solid .5pt;">RemovePreviousVersions</td>
<td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid .5pt;border-right:solid .5pt;">True</td>
</tr>
<tr>
<td style="padding-left:7px;padding-right:7px;border-top:none;border-left:solid .5pt;border-bottom:solid .5pt;border-right:solid .5pt;">Version</td>
<td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid .5pt;border-right:solid .5pt;">1.0.0 (then increment for each build)</td>
</tr>
</tbody>
</table>
</div>
<p>The real key for me here is the RemovePreviousVersions option. If this is set to &#8220;False&#8221; then the developers will need to manually uninstall the previous package – regardless of whether they are installing an upgrade.</p>
<p>By setting this to &#8220;True&#8221;, <strong><em>we are encouraging the development team to remember to increment the version</em></strong> of the setup package every upgrade. Changing the version of the setup package at this stage may also prompt the developer to increment the assembly version as well.</p>
<p><img src="http://nickhoggard.files.wordpress.com/2011/06/060211_0023_biztalk20061.png?w=600" alt="" align="right" /></p>
<h3>Step 2 – Add all project output to the GAC</h3>
<p>In the &#8220;File System&#8221; setup, add a new target folder for the Global Assembly Cache. This is done by simply right-clicking on &#8220;File System on Target Machine&#8221;, then selecting &#8220;Add Special Folder&#8221;, then &#8220;Global Assembly Cache Folder&#8221;.</p>
<p>Now that the GAC folder is included in the installation folders list, add the &#8220;Primary Output&#8221; of your assemblies.</p>
<h3>Step 3 – Add all project output to the Application Folder.</h3>
<p>Technically this step is not really required – BizTalk only reads the assemblies from the GAC, so why bother putting them in the application folder as well …</p>
<p>There is a reason though – Visual Studio 2005 doesn&#8217;t allow you to reference a custom assembly directly from the GAC, so in order to allow the BizTalk Solution references to be upgraded each time a new copy of the assemblies is installed it is much easier to copy the output to the file system as well as the GAC.</p>
<h3>Step 4 – Compile the Installation File, and install on your BizTalk environment</h3>
<p>Not much to be said about this step really: compile the installation file and install onto the BizTalk development environment. I found I was doing this step fairly frequently through the day as incremental changes to the assemblies were made – so it pays to keep a network share to the installation folder open if possible.</p>
<p>Note that if the developer forgets to increment the version number of the installation package the installation will be blocked at this point. <strong>This is the desired result, as we always want the version incremented!</strong></p>
<h3>Step 5 – Add assembly references to your BizTalk solution</h3>
<p>Open your BizTalk solution and add references to the new assemblies directly from the application installation folder (typically <em>c:\program files\your company\your product</em>).</p>
<h3>Step 6 – Deploy to TEST and PROD environments the same way</h3>
<p>Now that we have a consistent package for the assemblies don&#8217;t forget to maintain that consistency across all deployment environments … not just your dev box!</p>
<h2>Resulting Development Process</h2>
<p>After the changes above have been implemented, the development process for on-going changes.</p>
<p><img src="http://nickhoggard.files.wordpress.com/2011/06/060211_0023_biztalk20062.png?w=600" alt="" /></p>
<h2>Other Approaches?</h2>
<p>I&#8217;d be quite keen to hear about how others have approached this problem. I&#8217;m unsure what is considered a <em>pragmatic</em> best practice in this space – and I can already hear the developers shouting about the extra steps introduced here! Is there a better way to do this while still meeting the requirements listed at the top of this post?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=126&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2011/06/02/biztalk-2006-and-versioning-gac%e2%80%99d-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>

		<media:content url="http://nickhoggard.files.wordpress.com/2011/06/060211_0023_biztalk20061.png" medium="image" />

		<media:content url="http://nickhoggard.files.wordpress.com/2011/06/060211_0023_biztalk20062.png" medium="image" />
	</item>
		<item>
		<title>Adding Integration Tests to TFS Build Workflow</title>
		<link>http://nickhoggard.wordpress.com/2011/03/13/adding-integration-tests-to-tfs-build-workflow/</link>
		<comments>http://nickhoggard.wordpress.com/2011/03/13/adding-integration-tests-to-tfs-build-workflow/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 00:48:55 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Automated Build]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Team Foundation Server 2010]]></category>
		<category><![CDATA[TFS 2010]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=105</guid>
		<description><![CDATA[Overview In my last post I described how to deploy web applications to a build integration server using Team Foundation Server 2010. The next logical step once the build is successfully deploying to the integration server is to trigger a set of integration tests to verify the deployment. In this post I will describe the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=105&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Overview</h2>
<p>In my <a href="http://nickhoggard.wordpress.com/2011/03/08/simplifying-web-package-deployment-with-tfs-build/">last post</a> I described how to deploy web applications to a build integration server using Team Foundation Server 2010.  The next logical step once the build is successfully deploying to the integration server is to trigger a set of integration tests to verify the deployment.  In this post I will describe the changes to the Default Template build workflow to execute Integration Tests separately from the existing Unit Tests.</p>
<h2>Unit Tests</h2>
<p>It is important to consider at this stage why we would run integration unit tests, as opposed to the unit tests executed as part of the assembly build process.</p>
<p>Unit tests executed as part of the build are intended to verify the individual components are functioning correctly, and often would use mocked interfaces to ensure that only the specific functions being tested are executed.  Unit tests are typically not reliant on deployed components and therefore can be run as soon as the assemblies have been built.</p>
<p>Integration tests on the other hand are intended to run against the fully deployed environment to ensure that the individual components successfully execute together.  Integration tests therefore need to be executed <em>after </em>the application components have been deployed to an integration server.  Failures in integration testing might indicate breaking changes such as database changes, missing data, or changed interfaces into other components of the system.</p>
<div style="text-align:center;">
<table style="border-collapse:collapse;background:#d9d9d9;" border="0">
<col style="width:638px;"></col>
<tbody>
<tr>
<td style="padding-left:7px;padding-right:7px;border:solid .5pt;">Note that running the deployment and integration tests adds to the duration required to execute a built.  Rather than performing this action every time something in the solution changes it might be more pragmatic to have one <em>Build Definition</em> to build and run unit tests on a per-check-in basis, while another is configured for the full integration tests on a nightly basis.</td>
</tr>
</tbody>
</table>
</div>
<h2>Modify the Build Workflow</h2>
<p><img src="http://nickhoggard.files.wordpress.com/2011/03/031311_0048_addinginteg12.png?w=600" alt="" align="right" /></p>
<h3>Workflow Sequence Overview</h3>
<p>The integration tests have to run within the context of a build agent, to the activity needs to take place at the end of the <em>Run On Agent</em> activity, directly after the packages have been deployed to the build integration server within the <em>Deploy Packages </em>activity.</p>
<h3>Changing variable scopes</h3>
<p>Because we are going to borrow heavily from the existing &#8220;<em>Run Tests</em>&#8221; activity, but the execution will be <em>outside</em> the &#8220;<em>Try Compile, Test, and Associate Changesets and Work Items</em>&#8221; activity, we need to modify the scoping of the following variables.  This is easiest done by editing the xaml directly in your favourite xml editor.</p>
<ul>
<li><strong><em>outputDirectory</em></strong> &#8211; copy from the &#8220;<em>Compile and Test for Configuration</em>&#8221; activity up a level to the &#8220;<em>Run On Agent</em>&#8221; activity.</li>
<li><strong>treatTestFailureAsBuildFailure</strong> &#8211; copy from the <em>try</em> block of &#8220;<em>Try Compile, Test, and Associate Changesets and Work Items</em>&#8221; to the &#8220;<em>Run On Agent</em>&#8221; activity.</li>
</ul>
<h3>Add new Integration Tests workflow arguments</h3>
<p>The parameters being added are as follows:</p>
<ul>
<li><strong>Integration Tests Disabled </strong>(Boolean).  I&#8217;m not a fan of negative argument types (eg, Disabled, rather than Enabled), however have decided to keep this consistent with the existing <strong>Tests Disabled</strong> argument.</li>
<li><strong>Integration Test Specs</strong> (TestSpecList).</li>
</ul>
<p>The default value for the Integration Test Specs argument provides the defaults for filtering the unit tests to only the integration tests.  Ideally I would have liked to be able to filter this to *test*.dll with a test category of <em>Integration</em>, however based on some rudimentary experimentation it appears that the Test Assembly Spec constructor can only set the assembly name filter.  In the end I&#8217;ve used the following TestSpecList definition as the default value:</p>
<p style="margin-left:36pt;"><span style="font-size:8pt;"><strong><em><span style="color:blue;">New</span> Microsoft.TeamFoundation.Build.Workflow.Activities.<span style="color:#2b91af;">TestSpecList</span>(<br />
</em></strong></span></p>
<p style="margin-left:36pt;"><span style="font-size:8pt;"><strong><em><span style="color:blue;"> New</span> Microsoft.TeamFoundation.Build.Workflow.Activities.<span style="color:#2b91af;">TestAssemblySpec</span></em></strong></span></p>
<p style="margin-left:36pt;"><span style="font-size:8pt;"><strong><em> (<span style="color:#a31515;">&#8220;**\*test*.dll&#8221;</span>))<br />
</em></strong></span></p>
<div style="text-align:center;">
<table style="border-collapse:collapse;background:#d9d9d9;" border="0">
<col style="width:638px;"></col>
<tbody>
<tr>
<td style="padding-left:7px;padding-right:7px;border:solid .5pt;">Note: Don&#8217;t forget to change the <em>Metadata</em> property to ensure the new arguments are displayed in a suitable category in the Build Definition editor.</td>
</tr>
</tbody>
</table>
</div>
<h3>Add the Run Integration Tests Activity</h3>
<p>Follow the following steps to add the new Run Integration Tests activity to the workflow</p>
<ol>
<li>Add a new <em>foreach</em> activity after the <em>Deploy Packages</em> activity, but still within the <em>Run on Agent</em> activity.  This activity will be used to iterate through the project configurations defined in the build definition.<br />
<span style="color:blue;font-size:8pt;">&lt;<span style="color:#a31515;">ForEach<span style="color:blue;"><span style="color:red;"> x:TypeArguments<span style="color:blue;">=</span>&#8220;<span style="color:blue;">mtbwa:PlatformConfiguration</span>&#8220;<span style="color:blue;"><span style="color:red;"> DisplayName<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Run Integration Tests</span>&#8220;<span style="color:blue;"><span style="color:red;"> Values<span style="color:blue;">=</span>&#8220;<span style="color:blue;">[BuildSettings.PlatformConfigurations]</span>&#8220;<span style="color:blue;">&gt;</span></span></span></span></span></span></span></span><br />
&lt;<span style="color:#a31515;">ActivityAction<span style="color:blue;"><span style="color:red;"> x:TypeArguments<span style="color:blue;">=</span>&#8220;<span style="color:blue;">mtbwa:PlatformConfiguration</span>&#8220;<span style="color:blue;">&gt;</span></span></span></span><br />
&lt;<span style="color:#a31515;">ActivityAction.Argument<span style="color:blue;">&gt;</span></span><br />
&lt;<span style="color:#a31515;">DelegateInArgument<span style="color:blue;"><span style="color:red;"> x:TypeArguments<span style="color:blue;">=</span>&#8220;<span style="color:blue;">mtbwa:PlatformConfiguration</span>&#8220;<span style="color:blue;"><span style="color:red;"> Name<span style="color:blue;">=</span>&#8220;<span style="color:blue;">platformConfiguration</span>&#8220;<span style="color:blue;"> /&gt;</span></span></span></span></span></span><br />
&lt;/<span style="color:#a31515;">ActivityAction.Argument<span style="color:blue;">&gt;</span></span><br />
…<br />
&lt;/<span style="color:#a31515;">ForEach<span style="color:blue;">&gt;<br />
</span></span></span></li>
<li>Create a copy of the existing activity titled <em>&#8220;If Not Disable Tests&#8221; </em>into<em> </em>the<em> </em>foreach statement created above</li>
<li>Modify the copied workflow to use the added workflow arguments
<ul>
<li>Use <strong><em>Integration Tests Disabled </em></strong>instead of <strong><em>Disable Tests</em></strong></li>
<li>Use <strong><em>Integration Test Specs </em></strong>instead of <strong><em>Test Specs</em></strong></li>
</ul>
</li>
</ol>
<h3>Configure the Build Definition</h3>
<p>Configuring the filters for your integration tests is a matter for personal preference, though I&#8217;ve found the following approaches fairly simple;</p>
<ul>
<li>Define all integration tests in a separate project and utilise the <em>Test Assembly Filespec</em> filter</li>
<li>Add a <em>Test Category</em> of Integration to each of the tests and use the Category Filter.</li>
<li>Configure a custom <em>testsettings </em>file to allow for accurately specifying the order tests should be executed</li>
</ul>
<p><img src="http://nickhoggard.files.wordpress.com/2011/03/031311_0048_addinginteg22.png?w=600" alt="" /></p>
<h2>What&#8217;s Next?</h2>
<p>Having the integration tests successfully executed is all fine and good however you will find that it is necessary to configure the endpoints in the app.config file of your unit tests project to always point to the integration server, which causes some inconvenience if you wish to run the same tests locally on a development environment.</p>
<p>In a future post, I will have a look at how to perform transformations on the app.config file as part of the deployment, similar to the way web.config is transformed as part of the deployment package creation.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=105&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2011/03/13/adding-integration-tests-to-tfs-build-workflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>

		<media:content url="http://nickhoggard.files.wordpress.com/2011/03/031311_0048_addinginteg12.png" medium="image" />

		<media:content url="http://nickhoggard.files.wordpress.com/2011/03/031311_0048_addinginteg22.png" medium="image" />
	</item>
		<item>
		<title>Simplifying Web Package Deployment with TFS Build</title>
		<link>http://nickhoggard.wordpress.com/2011/03/08/simplifying-web-package-deployment-with-tfs-build/</link>
		<comments>http://nickhoggard.wordpress.com/2011/03/08/simplifying-web-package-deployment-with-tfs-build/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 08:33:18 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Automated Build]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Team Foundation Server 2010]]></category>
		<category><![CDATA[TFS Work Item Type Definition]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=90</guid>
		<description><![CDATA[Overview In my last post several months ago I described some of the work we&#8217;ve been doing to automate web package deployment using MSDeploy and Team Foundation Server 2010 Build Server. In that post I introduced a number of &#8220;hard coded&#8221; customisations to the Default Template workflow script that is used to drive the TFS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=90&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Overview</h2>
<p>In my <a href="http://nickhoggard.wordpress.com/2010/08/21/first-look-using-tfs2010-for-continuous-integration/">last post</a> several months ago I described some of the work we&#8217;ve been doing to automate web package deployment using MSDeploy and Team Foundation Server 2010 Build Server. In that post I introduced a number of &#8220;hard coded&#8221; customisations to the <em>Default Template</em> workflow script that is used to drive the TFS Build.</p>
<p>Recently I&#8217;ve been refining this script further to allow the reuse of the unmodified workflow scripts between projects through the use of XAML arguments, and thought I might share the output.</p>
<h2>Parameterising the MS Deploy activity</h2>
<p>This post will focus on modifications to the standard workflow template to allow for an MS Deploy activity to be invoked based purely on the build definition, rather than customising the workflow for each team project.</p>
<h3>Step 1: Add parameters to the Default Template <em>xaml</em> file</h3>
<p>I did take one shortcut at this stage – the &#8216;ideal&#8217; approach to collecting the deployment parameter information would be to create a strong typed object structure, then import that into the build process. I&#8217;m trying to avoid this at the moment, as we don&#8217;t currently need any custom assemblies for the build process and I&#8217;m trying to avoid adding extra dependencies.</p>
<p>Therefore I have used the very limited approach of defining a single set of deployment arguments, as opposed to a nice and tidy collection of strongly typed objects we could loop though.</p>
<p>The parameters being added are as follows:</p>
<ul>
<li>Deploy Package 1 (default false)</li>
<li>Deploy Package 1 Package Path</li>
<li>Deploy Package 1 Script</li>
<li>Deploy Package 1 Script Args</li>
</ul>
<p><img src="http://nickhoggard.files.wordpress.com/2011/03/030811_0833_simplifying11.png?w=600" alt="" /></p>
<p><img src="http://nickhoggard.files.wordpress.com/2011/03/030811_0833_simplifying21.png?w=600" alt="" align="right" /></p>
<h3>Step 2: Setup the metadata to group the deployment arguments</h3>
<p>By default, all the added arguments will be added to the &#8220;Misc&#8221; category in the Build Definition Editor. Once you&#8217;ve added more than a couple of customizations this becomes fairly confusing so it is important to setup the metadata as you go.</p>
<ol>
<li>Find the <em>Metadata</em> argument within the Arguments list</li>
<li>Click the &#8216;…&#8217; button top open the dialog editor</li>
<li>Add a new entry for each new argument added</li>
<li>Ensure that the <em>Category</em> is the same for each parameter to ensure they are grouped together</li>
</ol>
<h3>Step 3: Modify the Invoke Process activity to use the arguments</h3>
<p>For this demonstration I&#8217;ve chosen to trigger the deployment immediately after the <em>&#8220;Try Compile, Test and Associate Changesets and Work Items block&#8221;.</em> This is convenient, since it is directly after the output directories are populated – though I am not yet sure that this step will stay here once the integration tests are plugged in.</p>
<p>The parameterized activity results in the following xaml being produced.</p>
<p style="margin-left:36pt;"><span style="color:blue;font-family:Courier New;font-size:8pt;">&lt;<span style="color:#a31515;">If <span style="color:blue;"><span style="color:red;">Condition<span style="color:blue;">=</span>&#8220;<span style="color:blue;">[DeployPackage1]</span>&#8221; <span style="color:blue;"><span style="color:red;">DisplayName<span style="color:blue;">=</span>&#8220;<span style="color:blue;">If Deploy Package 1</span>&#8220;<br />
  </span></span></span></span></span></span><span style="color:blue;font-family:Courier New;font-size:8pt;">&lt;<span style="color:#a31515;">If.Then<span style="color:blue;">&gt;<br />
    </span></span></span><span style="color:blue;font-family:Courier New;font-size:8pt;">&lt;<span style="color:#a31515;">Sequence <span style="color:blue;"><span style="color:red;">DisplayName<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Deploy Package 1</span>&#8221; <span style="color:blue;"><span style="color:red;">tbwt:BuildTrackingParticipant.Importance<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Low</span>&#8220;<span style="color:#0000ff;">&gt;<br />
      </span></span></span></span></span></span></span><span style="color:blue;font-family:Courier New;font-size:8pt;">&lt;<span style="color:#a31515;">mtbwa:InvokeProcess <span style="color:blue;"><span style="color:red;">Arguments<span style="color:blue;">=</span>&#8220;<span style="color:blue;">[DeployPackage1ScriptArgs]</span>&#8221; </span></span></span></span><span style="color:red;font-family:Courier New;font-size:8pt;">DisplayName<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Deploy Package 1</span>&#8220;<br />
          </span><span style="color:red;font-family:Courier New;font-size:8pt;">FileName<span style="color:blue;">=</span>&#8220;<span style="color:blue;">[String.Format(<span style="color:red;">&amp;quot;<span style="color:blue;">{0}\{1}<span style="color:red;">&amp;quot;<span style="color:blue;">, BuildDetail.DropLocation, DeployPackage1Script)]</span>&#8220;<br />
</span></span></span></span></span><span style="color:blue;font-family:Courier New;font-size:8pt;">      &lt;/<span style="color:#a31515;">mtbwa:InvokeProcess<span style="color:blue;">&gt;<br />
    </span></span></span><span style="color:blue;font-family:Courier New;font-size:8pt;">&lt;/<span style="color:#a31515;">Sequence<span style="color:blue;">&gt;<br />
  </span></span></span><span style="color:blue;font-family:Courier New;font-size:8pt;">&lt;/<span style="color:#a31515;">If.Then<span style="color:blue;">&gt;<br />
</span></span></span><span style="color:blue;font-size:8pt;"><span style="font-family:Courier New;">&lt;/<span style="color:#a31515;">If<span style="color:blue;">&gt;</span></span></span></span></p>
<p>You&#8217;ll note that I&#8217;ve wrapped the old Invoke Process activity in a new If block – the primary purpose of this is to allow us to use this workflow even for projects that do not use the build features.</p>
<div style="text-align:center;">
<table style="border-collapse:collapse;background:#d9d9d9;" border="0">
<col style="width:638px;" span="1"></col>
<tbody>
<tr>
<td style="padding-left:7px;padding-right:7px;"><em>Note: Don&#8217;t forget to check-in your xaml changes at this point – otherwise you will not be able to set any of your new arguments in the build definition editor!</em></td>
</tr>
</tbody>
</table>
</div>
<h3>Step 4: Setup the Build Definition</h3>
<div style="text-align:center;">
<table style="border-collapse:collapse;background:#d9d9d9;" border="0">
<col style="width:638px;" span="1"></col>
<tbody>
<tr>
<td style="padding-left:7px;padding-right:7px;"><em>Note that this assumes you have already prepared your destination server to allow for remote deployments. See my previous post on <a href="http://nickhoggard.wordpress.com/2010/08/21/first-look-using-tfs2010-for-continuous-integration/">Using TFS Build Server for Continuous Integration</a> for help with this configuration if necessary.</em></td>
</tr>
</tbody>
</table>
</div>
<p> The final step is to setup the build definition.</p>
<ol>
<li>Create a new Build Definition</li>
<li>On the Process tab, note that a new category for &#8220;Deploy Package 1&#8243; is now displayed</li>
<li>Enter the path to your deployment package, relative to the output directory. Typically this is <em>_PublishedWebsites\MyProject_Package</em>.</li>
<li>Enter the name of the generated command script file.</li>
<li>Enter the arguments required for the command script file. Typically this is <em>/y /M:ServerName /u:UserName /p:Password</em>.</li>
<li>Change the <em>Deploy Package 1</em> flag to true.</li>
</ol>
<p><img src="http://nickhoggard.files.wordpress.com/2011/03/030811_0833_simplifying31.png?w=600" alt="" /></p>
<h3>Step 5: Trigger a build, and watch it work!</h3>
<p> </p>
<h2>Whats Next?</h2>
<p>There are a number of changes that we have introduced to the standard workflow, that I will endeavour to describe in my next few posts;</p>
<ul>
<li>Cleaning up the <em>Output Directory</em> to include only packages</li>
<li>Running <em>Integration</em> tests post-deployment</li>
<li>Using transformations on the integration test app.config file to modify the target endpoints for testing</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/90/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=90&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2011/03/08/simplifying-web-package-deployment-with-tfs-build/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>

		<media:content url="http://nickhoggard.files.wordpress.com/2011/03/030811_0833_simplifying11.png" medium="image" />

		<media:content url="http://nickhoggard.files.wordpress.com/2011/03/030811_0833_simplifying21.png" medium="image" />

		<media:content url="http://nickhoggard.files.wordpress.com/2011/03/030811_0833_simplifying31.png" medium="image" />
	</item>
		<item>
		<title>TFS Automated Deploy – Avoid MSDEPLOY Deleting Log Files</title>
		<link>http://nickhoggard.wordpress.com/2010/08/26/tfs-automated-deploy-%e2%80%93-avoid-msdeploy-deleting-log-files/</link>
		<comments>http://nickhoggard.wordpress.com/2010/08/26/tfs-automated-deploy-%e2%80%93-avoid-msdeploy-deleting-log-files/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 19:55:04 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Automated Build]]></category>
		<category><![CDATA[TFS 2010]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=79</guid>
		<description><![CDATA[Last weekend I posted the details of how we are using TFS Build Server in conjunction with the Web Deployment Toolkit to enable automated build and deploy of some of our internal development environments. One piece of feedback that I received from the previous post was that the configuration by default will delete all files [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=79&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last weekend I <a href="http://nickhoggard.wordpress.com/2010/08/21/first-look-using-tfs2010-for-continuous-integration/">posted</a> the details of how we are using TFS Build Server in conjunction with the Web Deployment Toolkit to enable automated build and deploy of some of our internal development environments.</p>
<p>One piece of feedback that I received from the previous post was that the configuration by default will delete all files in the deployment destination location.  Normally this is perfectly acceptable behaviour – but in other cases less than ideal.  Specifically, one of the solutions that we are building logs output to a logging folder within the application directory, and we do not want to lose the logs each time a build is deployed.</p>
<p>This is easily solved when deploying using the one-click publishing functionality in Visual Studio 2010 by selecting the &#8220;Leave Extra Files on Destination&#8221; option on the Publish dialog for a web application (the Publish dialog can be accessed by right clicking on the web application project in Solution Explorer, then selecting Publish) – but the solution is less obvious when using MSDEPLOY or the TFS 2010 build packages directly.</p>
<p>After some time searching through Google I came across <a href="http://forums.iis.net/t/1164755.aspx">this thread</a> that describes the MSDEPLOY parameter <em>–enablerule:DoNotDeleteRule.</em> This parameter can be added to the Windows Workflow script used by TFS2010 for a build definition by modifying the InvoiceProcess activity used in my previous post as follows (change marked in red):</p>
<p><span style="font-family:Courier New;font-size:8pt;">&lt;<span style="color:#gray;">mtbwa:InvokeProcess<br />
Arguments<span style="color:blue;">=&#8221;/y /M:<span style="color:black;"><strong>YourServer</strong><span style="color:blue;"> /u:</span><strong>UserName</strong></span> /p:</span><strong>Password</strong></span><br />
<span style="color:blue;">&amp;quot;-setParam:&#8217;IIS Web Application Name&#8217;=&#8217;</span><strong>IISSite/VirtualDirectory</strong><span style="color:blue;">&#8216;&amp;quot; <span style="color:red;"><strong>-enablerule:DoNotDeleteRule</strong><span style="color:blue;">&#8220;<span style="color:gray;"><br />
<span style="color:#gray;">DisplayName<span style="color:blue;">=&#8221;Deploy Web Service&#8221;<span style="color:gray;"><br />
<span style="color:#gray;">FileName<span style="color:blue;">=&#8221;[String.Format(&amp;quot;{0}\<span style="color:black;"><strong>YourProjectName</strong><span style="color:blue;">\<span style="color:black;"><strong>YourProjectName</strong><span style="color:blue;">.deploy.cmd&amp;quot;, BuildDetail.DropLocation)]&#8220;&gt;<br />
&lt;/<span style="color:#a31515;">mtbwa<span style="color:blue;">:<span style="color:#gray;">InvokeProcess<span style="color:blue;">&gt;</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=79&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2010/08/26/tfs-automated-deploy-%e2%80%93-avoid-msdeploy-deleting-log-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>
	</item>
		<item>
		<title>First Look: Using TFS2010 for Continuous Integration</title>
		<link>http://nickhoggard.wordpress.com/2010/08/21/first-look-using-tfs2010-for-continuous-integration/</link>
		<comments>http://nickhoggard.wordpress.com/2010/08/21/first-look-using-tfs2010-for-continuous-integration/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 11:21:50 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Automated Build]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Team Foundation Server 2010]]></category>
		<category><![CDATA[TFS 2010]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=73</guid>
		<description><![CDATA[Overview Any programmers reading this might remember what their first attempt at coding resulted in. Undoubtedly it lacked a lot of the finesse of something that you would write today. The output of my first real attempt at using TFS as a build server feels much the same as that first page of code many [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=73&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Overview</h2>
<p>Any programmers reading this might remember what their first attempt at coding resulted in.  Undoubtedly it lacked a lot of the finesse of something that you would write today.  The output of my first real attempt at using TFS as a build server feels much the same as that first page of code many years ago.  I&#8217;m sure there are many things that could be done more &#8216;correctly&#8217;, and for this reason I don&#8217;t really recommend this post as learning material for getting started with TFS Build.</p>
<p>The scenario I&#8217;m working towards is to get an existing solution being compiled and deployed in a pseudo continuous-integration setup.  I say <em>pseudo continuous-integration</em> in this case, because I&#8217;m ignoring a number of key steps at this stage.  Specifically, I&#8217;m not customising the configuration files for different environments, deploying the database projects, or looking at how to retarget the automated integration tests at the deployed server.</p>
<p>The VS2010 solution for this scenario contains three WCF services based web service projects (as well as a number of supporting assemblies), all targeting .NET 3.5.  I&#8217;m making use of the Web Deployment packaging and deployment tools provided as part of Visual Studio.</p>
<h2>Preparation</h2>
<ul>
<li>Download and install the <a href="http://go.microsoft.com/?linkid=9684517">Microsoft Web Deployment Tool</a> (or the <a href="http://go.microsoft.com/?linkid=9684516">32bit equivalent</a>) on the deployment machine (where the web services will ultimately be deployed).</li>
<li>Create the IIS Web Site on the deployment server.  The Virtual Directories will be created automatically, but we do need the IIS Site in place to start with.</li>
<li>Create a TFS Build Agent on the TFS server (See MSDN article <a href="http://msdn.microsoft.com/en-us/library/bb399135.aspx">Create and Work with Build Agents</a> for details)</li>
</ul>
<p><strong>Lesson Learned 1:</strong><em> The Web Deployment Tool does not install the Remote Agent Service by default.   Be sure to select this option as part of the installation Wizard.  If the Remote Agent Service is not configured correctly, the deployment activities outlined later in this past will result in an error message &#8220;The response header &#8216;MSDeploy.Response&#8217; was &#8221; but &#8216;v1&#8242; was expected&#8221;.<br />
</em></p>
<p><strong>Lesson Learned 2:</strong><em><strong> </strong>The Web Deployment Agent Service is configured to start manually by default.  It is necessary to reconfigure this to start automatically.<br />
</em></p>
<p><img src="http://nickhoggard.files.wordpress.com/2010/08/082110_1121_firstlookus1.png?w=600" alt="" align="right" /><strong>Lesson Learned 3: </strong><em>If you use the default Working Directory for your build agent then the path will include the full name of your TFS project.  This can cause issues building as I have seen instances where the maximum length of the filename and path combined has exceeded the maximum (which surprisingly is only about 260 characters).  To avoid this I&#8217;ve used the Build Definition ID rather than the Build Definition Path parameter as part of my Working Directory setup.<br />
</em></p>
<h2>Basics First – Building the Solution</h2>
<p><img src="http://nickhoggard.files.wordpress.com/2010/08/082110_1121_firstlookus2.png?w=600" alt="" align="right" />Setup a new definition by right clicking on the Builds node within Team Explorer for your Team Project and selecting &#8220;New Build Definition&#8221;.</p>
<p>You will need to select a UNC path for the output location on the Build Defaults tab, but aside from that the only configuration we need to worry about for now is on the Process tab.</p>
<p>For the moment, the only setting we need to change is to select the solution file to build, and select the build configuration.  Since this is for an internal test deployment environment, I&#8217;ve chosen to use a Debug build for the moment.</p>
<p><strong>Lesson Learned 4:</strong><em> Avoid spaces in the Build Definition Name.  I&#8217;m sure this problem can be avoided by quoting the execution command – but I some problems executing the web deployment command file due to spaces in the path.</em></p>
<p>With the build configuration saved, simply right click on the newly created build in Team Explorer and select &#8220;Queue New Build&#8221;.  I&#8217;ve found that even if the solution is already building successfully on a local machine, there is still some effort required at this stage to work through any build errors that are produced on the server.</p>
<p><strong>Lesson Learned 5: </strong><em>The TFS Build Server is missing some resources required to build advanced projects.  One such issue I ran into was an error stating that &#8220;resgen.exe&#8221; could not be found on the server.  This can be resolved by either installing Visual Studio 2010 on the Team Foundation Server (an option I wasn&#8217;t really all that keen on), or install the Windows SDK.<br />
</em></p>
<h2>Next Step &#8211; Setup Web Deployment Packages</h2>
<p>Configure the Package setup options for each WCF service being deployed by right clicking on the WCF project in Solution Explorer, and selecting &#8220;Package/Publish Settings&#8221;.</p>
<p>In general, the default settings are enough to get the package building; however for this scenario I&#8217;ve tweaked the following:</p>
<ul>
<li>Uncheck the option to &#8220;Include all databases …&#8221;.   For the moment I&#8217;m excluding this because I am not trying to automate the deployment of the database – but even when we do get to this, I believe that the Database project would be better handled with its own deployment package.</li>
<li>Change the IIS Site and Application Name for the destination server to something more appropriate.  The syntax used here is {ISS Web Site Name}/{Virtual Directory Name}.</li>
</ul>
<p><strong>Lesson Learned 6: </strong>TFS doesn&#8217;t build web deployment packages by default.  Having the WCF projects configured in Visual Studio 2010 isn&#8217;t quite enough – we also need to instruct TFS to build the packages as part of a build.  The easiest way to do this is to modify build definition (right click on the build configuration in Team Explorer, select Edit Build Definition) to include the following MSBuild Arguments on in the Advanced section of the Process tab:</p>
<p style="margin-left:72pt;">/P:CreatePackageOnPublish=true /P:DeployOnBuild=true</p>
<h2>Final Step – Build Template Tweaks to Deploy Web Packages</h2>
<p>The build templates are stored as Windows Workflow files within the TFS project folder <em>$/{Project}/BuildProcessTemplates</em>.  You can either choose to edit the Default Template (it is in source control after all, so there is no risk in messing this up), or create a new template to work from.</p>
<p>Note that if you create a new build template, you must be sure to set the Build Definition to use the appropriate build template file using the drop down list at the top of the Process tab of the Edit Build Definition dialog.</p>
<p>Within the build template, I&#8217;ve made all my modifications within the &#8220;<em>Revert Workspace and Copy Files to Drop Location</em>&#8221; step, which in turn is within the finally block of the  &#8220;<em>Try Compile, Test, and Associate Changesets and Work Items</em>&#8221; workflow step.   Note that each of these tasks can be added via the Windows Workflow user interface in Visual Studio – though I&#8217;ve found that editing the XML file directly is quicker on a machine with limited resources.</p>
<h3>Remove the CopyDirectory task for the Binaries Directory:</h3>
<p>By default, the TFS build template will copy all the project output into the Build output location.  This includes all project files (such as ASPX, SVC and ASMX files), as well as all the compiled binaries.  Since we are deploying our application using Web Deployment packages my preference is not to have anything in the output folder except for the required packages.</p>
<p><span style="font-size:8pt;"><span style="color:green;font-family:Courier New;">&lt;!— &lt;mtbwa:CopyDirectory Destination=&#8221;[BuildDetail.DropLocation]&#8221; DisplayName=&#8221;Copy Files to Drop Location&#8221;  Source=&#8221;[BinariesDirectory]&#8221; /&gt; &#8211;&gt;</span><br />
</span></p>
<h3>Add a <em>CopyDirectory</em> task to copy the web deployment package output:</h3>
<p><span style="font-family:Courier New;font-size:8pt;">&lt;<span style="color:red;">mtbwa<span style="color:blue;">:<span style="color:#a31515;">CopyDirectory</span></span><br />
DisplayName<span style="color:blue;">=&#8221;Copy Deployment Package to Drop Location&#8221;</span></span></span><span style="font-family:Courier New;font-size:8pt;"><span style="color:red;"><br />
Destination<span style="color:blue;">=&#8221;[String.Format(&amp;quot;{0}\</span><span style="color:black;"><strong>YourProjectName</strong></span><span style="color:blue;">&amp;quot;, BuildDetail.DropLocation)]&#8220;</span><br />
</span><span style="color:red;">Source<span style="color:blue;">=&#8221;[String.Format(&amp;quot;{0}\_PublishedWebsites\</span><span style="color:black;"><strong>YourProjectName</strong></span><span style="color:blue;">_Package&amp;quot;, BinariesDirectory)]&#8221; /&gt;<br />
</span></span></span></p>
<h3>Add an <em>InvokeProcess</em> task to run the generated deployment command file:</h3>
<p><span style="font-family:Courier New;font-size:8pt;">&lt;<span style="color:red;">mtbwa<span style="color:blue;">:<span style="color:#a31515;">InvokeProcess</span></span><br />
Arguments<span style="color:blue;">=&#8221;/y /M:</span><span style="color:black;"><strong>YourServer</strong></span></span><span style="color:blue;"> /u:</span><strong>UserName</strong> <span style="color:blue;">/p:</span><strong>Password</strong> <span style="color:blue;">&amp;quot;-setParam:&#8217;IIS Web Application Name&#8217;=&#8217;</span><strong>IISSite/VirtualDirectory</strong><span style="color:blue;">&#8216;&amp;quot;&#8221;</span></span><span style="color:red;font-family:Courier New;font-size:8pt;"><span style="color:red;"><br />
DisplayName<span style="color:blue;">=&#8221;Deploy Web Service&#8221;</span><br />
</span>FileName<span style="color:blue;">=&#8221;[String.Format(&amp;quot;{0}\</span><span style="color:black;"><strong>YourProjectName</strong></span><span style="color:blue;">\</span><span style="color:black;"><strong>YourProjectName</strong></span><span style="color:blue;">.deploy.cmd&amp;quot;, BuildDetail.DropLocation)]&#8220;&gt;</span></span><span style="color:blue;font-family:Courier New;font-size:8pt;"><br />
&lt;/<span style="color:#a31515;">mtbwa<span style="color:blue;">:<span style="color:#a31515;">InvokeProcess<span style="color:blue;">&gt;<br />
</span></span></span></span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=73&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2010/08/21/first-look-using-tfs2010-for-continuous-integration/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>

		<media:content url="http://nickhoggard.files.wordpress.com/2010/08/082110_1121_firstlookus1.png" medium="image" />

		<media:content url="http://nickhoggard.files.wordpress.com/2010/08/082110_1121_firstlookus2.png" medium="image" />
	</item>
		<item>
		<title>Custom Date Format for the Work Item DateTimeControl (TFS2010)</title>
		<link>http://nickhoggard.wordpress.com/2010/07/18/custom-date-format-for-the-work-item-datetimecontrol-tfs2010/</link>
		<comments>http://nickhoggard.wordpress.com/2010/07/18/custom-date-format-for-the-work-item-datetimecontrol-tfs2010/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 23:56:21 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Team Foundation Server 2010]]></category>
		<category><![CDATA[TFS 2010]]></category>
		<category><![CDATA[TFS Work Item Type Definition]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=67</guid>
		<description><![CDATA[While working on a new work item template (WIT) for Team Foundation Server 2010 I encountered a requirement for a field where the user could select the time a call was received. The DateTimeControl for TFS work items displays only a date picker by default, which for this particular use case was not quite accurate enough. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=67&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While working on a new work item template (WIT) for Team Foundation Server 2010 I encountered a requirement for a field where the user could select the time a call was received. The DateTimeControl for TFS work items displays only a date picker by default, which for this particular use case was not quite accurate enough.</p>
<p>My first reaction was to start building a custom work item control – but with a bit of digging into the existing one using Reflector I discovered that the ability to change the control format was indeed supported, just not immediately obvious.</p>
<p>It turns out that for any implementation of IWorkItemControl, the Properties property is set to contain all the attributes on the controls declaration line within the WIT. For example, the following control declaration will result in four entries within the Properties collection (FieldName, Type, Label and LabelPosition).</p>
<p style="margin-left:85pt;"><span style="color:blue;font-size:8pt;"><span style="font-family:Courier New;">&lt;<span style="color:#a31515;">Control<span style="color:blue;"><br />
<span style="color:red;">FieldName<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Support.TimeReceived</span>&#8220;<span style="color:blue;"><br />
<span style="color:red;">Type<span style="color:blue;">=</span>&#8220;<span style="color:blue;">DateTimeControl</span>&#8220;<span style="color:blue;"><br />
<span style="color:red;">Label<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Time Received:</span>&#8220;<span style="color:blue;"><br />
<span style="color:red;">LabelPosition<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Left</span>&#8220;<span style="color:blue;"> /&gt;</span></span></span></span></span></span></span></span></span></span></span><br />
</span></p>
<p>Additional attributes can be added to the control without invalidating the schema, so work item controls can make use of this feature to support additional configuration parameters. The DateTimeControl includes the following properties that can be set using this mechanism:</p>
<ul>
<li><strong>Format: </strong>A valid selection from the DateTimePickerFormat enumeration (Long, Short, Time, Custom)</li>
<li><strong>CustomFormat: </strong>If the Format is set to Custom then the CustomFormat property is used to define the display format. This uses the standard formatting strings for .NET date formats.</li>
</ul>
<p>Thus the following control definition can be used to add a Time-aware picker to a work item.</p>
<p style="margin-left:85pt;"><span style="color:blue;font-size:8pt;"><span style="font-family:Courier New;">&lt;<span style="color:#a31515;">Control<span style="color:blue;"><br />
<span style="color:red;">FieldName<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Support.TimeReceived</span>&#8220;<span style="color:blue;"><br />
<span style="color:red;">Type<span style="color:blue;">=</span>&#8220;<span style="color:blue;">DateTimeControl</span>&#8220;<span style="color:blue;"><br />
<span style="color:red;">Label<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Time Received:</span>&#8220;<span style="color:blue;"><br />
<span style="color:red;">LabelPosition<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Left</span>&#8220;<span style="color:blue;"><br />
<span style="color:red;"><strong>Format<span style="color:blue;">=</span>&#8220;<span style="color:blue;">Custom</span>&#8220;<span style="color:blue;"><br />
<span style="color:red;">CustomFormat<span style="color:blue;">=</span>&#8220;<span style="color:blue;">dd/MM/yyyy hh:mm:ss</span>&#8220;</span></span></strong><span style="color:blue;"> /&gt;</span></span></span></span></span></span></span></span></span></span></span></span></span><br />
</span></p>
<p><img src="http://nickhoggard.files.wordpress.com/2010/07/071710_2356_customdatef1.png?w=600" alt="" align="right" />For anyone that prefers to use the WIT editor within the TFS Power Tools (found <a href="http://msdn.microsoft.com/en-us/vstudio/bb980963.aspx">here</a>), these properties can be added using the String Collection Editor associated with the Attributes property for the DateTimeControl.</p>
<p>As an added bonus, the control is rendered in correctly in both Team Explorer and Team Web Access views of the work item. Unfortunately it is not possible to change the DateTime selection to use the spin control (aka the up-down control) rather than the calendar drop down, but that is a relatively minor problem.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=67&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2010/07/18/custom-date-format-for-the-work-item-datetimecontrol-tfs2010/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>

		<media:content url="http://nickhoggard.files.wordpress.com/2010/07/071710_2356_customdatef1.png" medium="image" />
	</item>
		<item>
		<title>Debugging .NET IL at Runtime using Reflector / Deblector</title>
		<link>http://nickhoggard.wordpress.com/2010/06/17/debugging-net-il-at-runtime-using-reflector-deblector/</link>
		<comments>http://nickhoggard.wordpress.com/2010/06/17/debugging-net-il-at-runtime-using-reflector-deblector/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 00:31:32 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[MSIL]]></category>
		<category><![CDATA[Reflector]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=62</guid>
		<description><![CDATA[The other day we encountered a problem with some inconsistent processing within the POP adapter for BizTalk. If the adapter was processing an email with a very specific set of attachments, the adapter failed to hand the message out to the BizTalk engine, and all following messages on the receive adapter became blocked. Anecdotally we [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=62&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The other day we encountered a problem with some inconsistent processing within the POP adapter for BizTalk.   If the adapter was processing an email with a very specific set of attachments, the adapter failed to hand the message out to the BizTalk engine, and all following messages on the receive adapter became blocked.  Anecdotally we believed this was related to the S/MIME decoder being used by the adapter, but we were struggling with what specific characteristics of the attachments required to reproduce the issue.</p>
<p>Let me make this clear from the start … we didn&#8217;t actually manage to resolve this issue using this technique.  Having said that I did find the whole process of debugging IL for runtime code very interesting and wanted to share the basics for getting started.</p>
<h2>Step 1: Install the components</h2>
<p>The tools we used for this are both available for free download.  These will need to be copied onto the machine where the .NET process you wish to debug is located.</p>
<ul>
<li>Reflector (<a href="http://reflector.red-gate.com/Download.aspx">http://reflector.red-gate.com/Download.aspx</a>)</li>
<li>Reflector Add-in &#8220;Deblector&#8221; (<a href="http://deblector.codeplex.com/">http://deblector.codeplex.com/</a>)</li>
</ul>
<p>Installing reflector is just a matter of extracting the runtime files onto your machine.  The Add-in can be installed by extracting the files to a subdirectory under the Reflector application path, then adding the Add-in into Reflector (Menu -&gt; View -&gt; Add-in&#8217;s).</p>
<p>Deblector can then be activated within Reflector from the Tools menu.</p>
<h2>Step 2: Attach to the BizTalk process</h2>
<p>The next step is to load the required assemblies into Reflector.  In my case this was the Microsoft.BizTalk.Pipeline.Components.dll file that comes with BizTalk Server 2006.</p>
<p>Note that at this stage it pays to navigate through the methods you are likely to be debugging, to ensure that all the dependant assemblies are also included.  Reflector will prompt you to load any decencies that are identified for the methods you are reading.  This is also a good chance to learn a bit about how the application hangs together, and where logical debugging breakpoints should be applied.</p>
<p><img src="http://nickhoggard.files.wordpress.com/2010/06/061710_0031_debuggingne1.png?w=600" alt="" align="right" />Once the assemblies have been loaded we need to attach Deblector to the process to be debugged.  In my case this was the BTSNTSvc.exe process.</p>
<p>Note: For BizTalk this got a bit complicated as there are a number of instances of this process running, so some trial and error was required to find the right one.  I also found that stopping all the host instances in BizTalk Administration Console except for the one containing the pipeline you wish to debug was helpful to help filter the list.</p>
<p><em>Note that the debugger is automatically in pause mode when you attach to the process.<br />
</em></p>
<h2>Step 3: Set your breakpoints, and Debug!</h2>
<p>Using the explorer included in Reflector, navigate to the method to be debugged (in my case, MIME_SMIME_Decoder.Execute2).</p>
<p>Examine the IL view, and identify a line that you recognise.  Reading IL can be a bit daunting, and I&#8217;m definitely not proficient with this as a language.  I&#8217;ve found that searching for strings used for writing log files</p>
<p><img src="http://nickhoggard.files.wordpress.com/2010/06/061710_0031_debuggingne2.png?w=600" alt="" align="right" />Setting up the breakpoint had me a bit confused to begin with, as I could see the breakpoint button but it was not obvious as to how to select the line to apply the breakpoint to.  In the end it&#8217;s as simple as selecting the line in the <em>IL View</em> tab and clicking the breakpoint icon.  Alternatively you can use the <em>Command</em> textbox and the break command (b [location]). I found this useful when wanting to re-setup a number of breakpoints after restarting the BizTalk process and reattaching the debugger.</p>
<p>At this stage you also want to consider whether you want the debugger to break if an exception is thrown.  This can be toggled using one of the icons on the toolbox.</p>
<p>Once you have all the breakpoints setup and ready to go, click the <em>Play</em> icon to let the attached process continue until the next breakpoint.</p>
<p>Now it&#8217;s debugging as normal – except the commands being stepped through take a bit more effort to comprehend.  As a final note, I did notice that the highlighted line is often indicating the instruction <em>prior</em> to the one being executed so if you want to step into a specific function call then you need to do so a couple of instructions before the function is called.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=62&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2010/06/17/debugging-net-il-at-runtime-using-reflector-deblector/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>

		<media:content url="http://nickhoggard.files.wordpress.com/2010/06/061710_0031_debuggingne1.png" medium="image" />

		<media:content url="http://nickhoggard.files.wordpress.com/2010/06/061710_0031_debuggingne2.png" medium="image" />
	</item>
		<item>
		<title>TFS Timesheets is now on CodePlex</title>
		<link>http://nickhoggard.wordpress.com/2010/05/30/tfs-timesheets-is-now-on-codeplex-2/</link>
		<comments>http://nickhoggard.wordpress.com/2010/05/30/tfs-timesheets-is-now-on-codeplex-2/#comments</comments>
		<pubDate>Sun, 30 May 2010 11:10:17 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Team Foundation Server 2010]]></category>
		<category><![CDATA[TFS 2010]]></category>
		<category><![CDATA[TFS Work Item Type Definition]]></category>
		<category><![CDATA[Work Item Custom Control]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=57</guid>
		<description><![CDATA[One of the key weaknesses (in my opinion) with Team Foundation Server work items at present is the difficulty to record time spent against a project. Sure you can track time in the &#8216;Work Completed&#8217; field and can even report on what changes were made to this field over time. The difficulty is that this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=57&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the key weaknesses (in my opinion) with Team Foundation Server work items at present is the difficulty to record time spent against a project. Sure you can track time in the &#8216;Work Completed&#8217; field and can even report on what changes were made to this field over time. The difficulty is that this still assumes that developers will always update the work items on the correct day and fails to give simple visibility of how much time different team members have spent on a given work item.</p>
<p>Some time back I created a small timesheet utility for Team Foundation Server 2010. This was partly driven out of a requirement to be able to track this level of detail for a project I was working on, but also to serve as a sample project for my previous blog posts about creating custom work item controls;</p>
<ul>
<li><a href="http://nickhoggard.wordpress.com/2009/11/12/tfs-2010-beta-2-custom-work-item-controls-step-1-getting-started/"><span style="font-size:9pt;color:#3e62a6;font-family:Segoe UI;text-decoration:underline;">TFS2010 Custom Work Item Controls Part 1</span></a><span style="color:#30332d;font-family:Segoe UI;font-size:9pt;"><br />
</span></li>
<li><a href="http://nickhoggard.wordpress.com/2009/11/14/tfs-2010-beta-2-%e2%80%93-custom-work-item-controls-step-2-work-item-setup/"><span style="font-size:9pt;color:#3e62a6;font-family:Segoe UI;text-decoration:underline;">TFS2010 Custom Work Item Controls Part 2</span></a></li>
</ul>
<p> <span style="color:#30332d;">At the moment the code posted is far from perfect and </span>I haven&#8217;t had a lot of time for updating the sample since the posts, but as a number of people have requested access to either view or contribute to the source code I&#8217;ve decided to post it to CodePlex &#8216;warts and all&#8217; so to speak. If you are interested in the code for this component it can now be found at the following location.</p>
<ul>
<li><a href="http://tfstimesheets.codeplex.com/">http://tfstimesheets.codeplex.com/</a></li>
</ul>
<p>We&#8217;ve used this control on a couple of projects now and have found that it has helped to keep the work remaining / work completed values up to date by creating visibility of how much time team members are logging against work items on any given day. There are definitely some improvements that can be made (especially in terms of reporting) – so if you do happen to try out this component please drop me a note to let me know what you think, or if you have any ideas for how it could be improved!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=57&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2010/05/30/tfs-timesheets-is-now-on-codeplex-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>
	</item>
		<item>
		<title>Successfully upgraded TFS 2010 from Beta 2 to RC on EC2</title>
		<link>http://nickhoggard.wordpress.com/2010/02/14/successfully-upgraded-tfs-2010-from-beta-2-to-rc-on-ec2/</link>
		<comments>http://nickhoggard.wordpress.com/2010/02/14/successfully-upgraded-tfs-2010-from-beta-2-to-rc-on-ec2/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 06:41:26 +0000</pubDate>
		<dc:creator>Nick Hoggard</dc:creator>
				<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Team Foundation Server 2010]]></category>
		<category><![CDATA[TFS 2010]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://nickhoggard.wordpress.com/?p=47</guid>
		<description><![CDATA[Once again I have my TFS instance on EC2 up to date, and I&#8217;m able to connect to it successfully from my Visual Studio 2010 RC instance here at home. One word of advice though; once you install VS2010 RC, VS seems to crash if you then try to install Team Explorer 2010 Beta 2 so make sure [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=47&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Once again I have my<a href="http://nickhoggard.wordpress.com/2009/11/22/setting-up-a-tfs-development-environment-on-amazon-ec2/"> TFS instance on EC2</a> up to date, and I&#8217;m able to connect to it successfully from my Visual Studio 2010 RC instance here at home. One word of advice though; once you install VS2010 RC, VS seems to crash if you then try to install Team Explorer 2010 Beta 2 so make sure your code is all checked in before the upgrade, otherwise won&#8217;t be able to make this available to anyone else on your team until the process is complete!</p>
<p>I was surprised that I didn&#8217;t run into a few issues as part of this process, but the upgrade was fairly painless – thanks mostly to the <a href="http://blogs.msdn.com/bkrieger/archive/2010/02/03/tfs-2010-beta2-to-rc-upgrade-guide.aspx">TFS 2010 Beta 2 to RC Upgrade Guide</a> posted by Brian Krieger. I ran into a bit of trouble setting up SSRS and WSS again … but that was my own fault, not an issue with the upgrade process (I&#8217;d forgotten the credentials I&#8217;d used last time … <span style="font-family:Wingdings;">L</span>).</p>
<p>The good news though is that now seems to be working, including my old VS2010 Beta 2 solution files which opened without any issues or the need for an upgrade. </p>
<p>I did come across a breaking change in the TFS APIs. It would seem that the TeamFoundationServer class no longer supports the AuthorisedIdentity property (in fact the TeamFoundationServer class has now been depreciated in favor of TeamProjectCollection). Changing the reference to use TeamProjectCollection.AuthorizedIdentity seems to have resolved the problem, and everything is building again.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nickhoggard.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nickhoggard.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nickhoggard.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nickhoggard.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nickhoggard.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nickhoggard.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nickhoggard.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nickhoggard.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nickhoggard.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nickhoggard.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nickhoggard.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nickhoggard.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nickhoggard.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nickhoggard.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nickhoggard.wordpress.com&amp;blog=9996193&amp;post=47&amp;subd=nickhoggard&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nickhoggard.wordpress.com/2010/02/14/successfully-upgraded-tfs-2010-from-beta-2-to-rc-on-ec2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f91bdd085ba91c8cd4753d02f3969c5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nickhoggard</media:title>
		</media:content>
	</item>
	</channel>
</rss>
