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

<channel>
	<title>Haugerns Development Escapades &#187; cruisecontrol.net</title>
	<atom:link href="http://www.haugern.net/blog/category/cruisecontrolnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.haugern.net/blog</link>
	<description>Morten Haug on development and other curiosities</description>
	<lastBuildDate>Sun, 31 May 2009 21:56:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Automatic versioning with CruiseControl.Net and NAnt</title>
		<link>http://www.haugern.net/blog/automatic-versioning-with-cruisecontrolnet-and-nant/</link>
		<comments>http://www.haugern.net/blog/automatic-versioning-with-cruisecontrolnet-and-nant/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 18:53:22 +0000</pubDate>
		<dc:creator>haugern</dc:creator>
				<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[cruisecontrol.net]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[nant]]></category>
		<category><![CDATA[source control]]></category>
		<category><![CDATA[tfs]]></category>

		<guid isPermaLink="false">http://www.haugern.net/blog/automatic-versioning-with-cruisecontrolnet-and-nant/</guid>
		<description><![CDATA[I&#8217;ve created a similar setup as David Donald Belcham (a.k.a. igloocoder) mentions in this post for our current project at NOIS.
When I mean similar, we&#8217;re using the exact same tools for the job, with NAnt (asminfo task) &#38; CC.NET. But there&#8217;s a couple of differences.
New labeller for CC.NET
The first, and minor difference is the labeller. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a similar setup as <strike>David</strike> Donald Belcham (a.k.a. igloocoder)<a href="http://igloocoder.com/archive/2008/01/04/versioning-applications-using-nant-and-cruisecontrol.net.aspx" target="_blank"> mentions in this post</a> for our current project at <a href="http://www.nois.no" target="_blank">NOIS</a>.</p>
<p>When I mean similar, we&#8217;re using the exact same tools for the job, with <a href="http://nant.sourceforge.net/" target="_blank">NAnt</a> (<a href="http://nant.sourceforge.net/release/0.85/help/tasks/asminfo.html" target="_blank">asminfo task</a>) &amp; <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" target="_blank">CC.NET</a>. But there&#8217;s a couple of differences.</p>
<h3>New labeller for CC.NET</h3>
<p>The first, and minor difference is the <a href="http://confluence.public.thoughtworks.org/display/CCNET/Labeller+Blocks" target="_blank">labeller</a>. I wanted the versions to work almost as the <a href="http://nantcontrib.sourceforge.net/release/latest/help/tasks/version.html" target="_blank">NAntContrib version task</a> with the automatic build &amp; revision based on day of year and time of day respectively. As most people were running the traditional ymmdd-format for the build, this effectively had to stop at the beginning of 07; 16 bit for the build number breaks that setup. So I settled for an algorithm which won&#8217;t break until the year 2066. The major &amp; minor numbers is set manually.</p>
<p>I couldn&#8217;t seem to find such a labeller <a href="http://www.google.com" target="_blank">out there</a>, and as I wanted the same number in the CC.NET build-number, and in the assemblies (and in the source control system as well, I&#8217;ll get back to that), CC.NET needed to be master. Not finding what I wanted, I created my own labeller for CC.NET, which gives me the build-numbering scheme I wanted.</p>
<p>With the <a href="http://confluence.public.thoughtworks.org/display/CCNET/Custom+Builder+Plug-in" target="_blank">extensibility-points in CC.NET</a> it was great fun, and real easy to deploy my own. Here&#8217;s the whole thing:</p>
<p><!--<br />
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red163\green21\blue21;}??\fs20 \cf1 using\cf0  System;\par ??\cf1 using\cf0  Exortech.NetReflector;\par ??\cf1 using\cf0  ThoughtWorks.CruiseControl.Core;\par ??\par ??\cf1 namespace\cf0  Haugern.Util.CCNet\par ??\{\par ??    [\cf4 ReflectorType\cf0 (\cf5 "versionLabeller"\cf0 )]\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 VersionLabeller\cf0  : \cf4 ILabeller\par ??\cf0     \{\par ??        [\cf4 ReflectorProperty\cf0 (\cf5 "major"\cf0 , Required = \cf1 true\cf0 )] \par ??        \cf1 public\cf0  \cf1 int\cf0  Major;\par ??        [\cf4 ReflectorProperty\cf0 (\cf5 "minor"\cf0 , Required = \cf1 true\cf0 )] \par ??        \cf1 public\cf0  \cf1 int\cf0  Minor;\par ??\par ??        \cf1 public\cf0  \cf1 string\cf0  Generate(\cf4 IIntegrationResult\cf0  integrationResult)\par ??        \{\par ??            \cf1 if\cf0 (integrationResult == \cf1 null\cf0 )\par ??                \cf1 throw\cf0  \cf1 new\cf0  \cf4 ArgumentNullException\cf0 (\cf5 "integrationResult"\cf0 );\par ??\par ??            \cf4 DateTime\cf0  now = \cf4 DateTime\cf0 .Now;\par ??            \cf1 return\cf0  Major + \cf5 "."\cf0  + Minor + \cf5 "."\cf0  + ComputeBuild(now) + \cf5 "."\cf0  + ComputeRelease(now);\par ??        \}\par ??\par ??        \cf1 private\cf0  \cf1 static\cf0  \cf1 string\cf0  ComputeRelease(\cf4 DateTime\cf0  now)\par ??        \{\par ??            \cf1 return\cf0  \cf4 Math\cf0 .Round((now.TimeOfDay.TotalSeconds/10)).ToString();\par ??        \}\par ??\par ??        \cf1 private\cf0  \cf1 static\cf0  \cf1 string\cf0  ComputeBuild(\cf4 DateTime\cf0  now)\par ??        \{\par ??            \cf1 return\cf0  now.ToString(\cf5 "yy"\cf0 ) + now.DayOfYear.ToString(\cf5 "000"\cf0 );\par ??        \}\par ??\par ??        \cf1 public\cf0  \cf1 void\cf0  Run(\cf4 IIntegrationResult\cf0  result)\par ??        \{\par ??            result.Label = Generate(result);\par ??        \}\par ??    \}\par ??\}}<br />
-->
<div style="font-size: small; background: white; color: black; font-family: courier new">
<p style="margin: 0px"><font size="2"><span style="color: blue">using</span> System;</font></p>
<p style="margin: 0px"><font size="2"><span style="color: blue">using</span> Exortech.NetReflector;</font></p>
<p style="margin: 0px"><font size="2"><span style="color: blue">using</span> ThoughtWorks.CruiseControl.Core;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;</font></p>
<p style="margin: 0px"><font size="2"><span style="color: blue">namespace</span> Haugern.Util.CCNet</font></p>
<p style="margin: 0px"><font size="2">{</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">ReflectorType</span>(<span style="color: #a31515">"versionLabeller"</span>)]</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">class</span> <span style="color: #2b91af">VersionLabeller</span> : <span style="color: #2b91af">ILabeller</span></font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp; {</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">ReflectorProperty</span>(<span style="color: #a31515">"major"</span>, Required = <span style="color: blue">true</span>)] </font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">int</span> Major;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">ReflectorProperty</span>(<span style="color: #a31515">"minor"</span>, Required = <span style="color: blue">true</span>)] </font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">int</span> Minor;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">string</span> Generate(<span style="color: #2b91af">IIntegrationResult</span> integrationResult)</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">if</span>(integrationResult == <span style="color: blue">null</span>)</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">ArgumentNullException</span>(<span style="color: #a31515">&#8220;integrationResult&#8221;</span>);</font></p>
<p style="margin: 0px"><font size="2">&nbsp;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #2b91af">DateTime</span> now = <span style="color: #2b91af">DateTime</span>.Now;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">return</span> Major + <span style="color: #a31515">&#8220;.&#8221;</span> + Minor + <span style="color: #a31515">&#8220;.&#8221;</span> + ComputeBuild(now) + <span style="color: #a31515">&#8220;.&#8221;</span> + ComputeRelease(now);</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p>
<p style="margin: 0px"><font size="2">&nbsp;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: blue">static</span> <span style="color: blue">string</span> ComputeRelease(<span style="color: #2b91af">DateTime</span> now)</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">return</span> <span style="color: #2b91af">Math</span>.Round((now.TimeOfDay.TotalSeconds/10)).ToString();</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p>
<p style="margin: 0px"><font size="2">&nbsp;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: blue">static</span> <span style="color: blue">string</span> ComputeBuild(<span style="color: #2b91af">DateTime</span> now)</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">return</span> now.ToString(<span style="color: #a31515">&#8220;yy&#8221;</span>) + now.DayOfYear.ToString(<span style="color: #a31515">&#8220;000&#8243;</span>);</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p>
<p style="margin: 0px"><font size="2">&nbsp;</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">void</span> Run(<span style="color: #2b91af">IIntegrationResult</span> result)</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result.Label = Generate(result);</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p>
<p style="margin: 0px"><font size="2">&nbsp;&nbsp;&nbsp; }</font></p>
<p style="margin: 0px"><font size="2">}</font></p>
</div>
<h3>Consistent Build Number</h3>
<p>The second difference (well, in his defence, it&#8217;s not even mentioned), is that the exact same label should be set back into the source control system. In our case, we&#8217;re using TFS Source Control, and <a href="http://confluence.public.thoughtworks.org/display/CCNET/Visual+Studio+Team+Foundation+Server+Plugin" target="_blank">with the standard plugin it was easy</a> to apply it there as well.</p>
<p>Now we got this great setup where we can track everything that happens back to the build-number as it is the same across the whole environment:</p>
<p>Application &lt;-&gt; Build server &lt;-&gt; Source Control</p>
<p>Consistent build number across the production line also means every build is a candidate for release.</p>
<p>Should some bug find it way through our thorough unit-testing &amp; qa-scheme into the hands of our customers, finding the right version to search for it will not be a problem!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.haugern.net/blog/automatic-versioning-with-cruisecontrolnet-and-nant/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NUnit swallowed errorcodes</title>
		<link>http://www.haugern.net/blog/nunit-swallowed-errorcodes/</link>
		<comments>http://www.haugern.net/blog/nunit-swallowed-errorcodes/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 14:28:31 +0000</pubDate>
		<dc:creator>haugern</dc:creator>
				<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[cruisecontrol.net]]></category>
		<category><![CDATA[nunit]]></category>

		<guid isPermaLink="false">http://www.haugern.net/blog/nunit-swallowed-errorcodes/</guid>
		<description><![CDATA[Update: The header is now in past tense as I figured out a GREAT solution; upgrade from 2.4.1 to 2.4.3!
By accident I earlier today checked in a failing unit-test to our TFS source control. While waiting for the dreaded red light from my CC tray I was about to fix it, when I suddenly discovered&#8230;
It [...]]]></description>
			<content:encoded><![CDATA[<p><font color="#ff0000">Update: The header is now in past tense as I figured out a GREAT solution; upgrade from 2.4.1 to 2.4.3!</font></p>
<p>By accident I earlier today checked in a failing unit-test to our TFS source control. While waiting for the dreaded red light from my CC tray I was about to fix it, when I suddenly discovered&#8230;</p>
<p><strong>It didn&#8217;t fail the build!</strong></p>
<p><a href="http://www.haugern.net/blog/wp-content/windowslivewriternunitswallowederrorcodes-d69dimage-4.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="117" alt="image" src="http://www.haugern.net/blog/wp-content/windowslivewriternunitswallowederrorcodes-d69dimage-thumb-1.png" width="270" border="0"></a> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Going through the build report revealed that it did in fact discover the failing test: </p>
<p><a href="http://www.haugern.net/blog/wp-content/windowslivewriternunitswallowederrorcodes-d69dimage-6.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="104" alt="image" src="http://www.haugern.net/blog/wp-content/windowslivewriternunitswallowederrorcodes-d69dimage-thumb-2.png" width="459" border="0"></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>I couldn&#8217;t really live with that so I started investigating. I tried the following:</p>
<ul>
<li>Testing the NAnt-target local on my machine &#8211; <strong>build successful</strong>
<li>Manually running NUnit with all the same parameters as in the build-file, checking errorcode after run &#8211; <strong>errorcode 0</strong> (success)
<li><em>At least now I know it&#8217;s NUnit that is failing</em>
<li>For no good reason at all I&#8217;m just trying the failing test-assembly, leaving the other test-assemblies alone &#8211; <strong>errorcode 1</strong> (1 failure)
<li><em>I&#8217;m on to something</em>
<li>I add another test-assembly that doesn&#8217;t have failing tests in it &#8211; <strong>errorcode 0</strong> (success)</li>
</ul>
<p>It looks like NUnit forgets the result from the first test, and is just giving me the errorcode from the latest test-assembly provided!</p>
<p>Adding several test-assemblies to a NUnit project however does work correctly.</p>
<h3>The solution</h3>
<p>I didn&#8217;t want to make &#8220;static&#8221; NUnit project files, so I had to look for answers somewhere else and turned to the NUnit home pages. Earlier searches for errorcodes didn&#8217;t bring me to these pages at all, but I started looking around on the site and I found my way into the release notes.</p>
<p>I was using version 2.4.1 from May, and there was a 2.4.3 out from August. I downloaded it, updated my solutions tools folder, and&#8230;.</p>
<p><strong>It was fixed (the build failed&#8230; confused yet?!?)!</strong></p>
<p>So, just to wrap it up: If you&#8217;ve been running NUnit 2.4.1 with more than one test-assembly, and your build server is happily saying the build is fine,<strong> don&#8217;t believe it!</strong></p>
<p><strong>Upgrade to a newer version and find out if your build is still fine .</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.haugern.net/blog/nunit-swallowed-errorcodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
