<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>GigPeppers</title>
	
	<link>http://www.gigpeppers.com/blog</link>
	<description>Life and Times of a Software Engineer</description>
	<lastBuildDate>Sun, 10 May 2009 04:54:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Gigpeppers" /><feedburner:info uri="gigpeppers" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>Gigpeppers</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Integrating NCover 1.5 with Nant builds</title>
		<link>http://feedproxy.google.com/~r/Gigpeppers/~3/9JmiemzChZU/</link>
		<comments>http://www.gigpeppers.com/blog/2009/05/01/integrating-ncover-15-with-nant-builds/#comments</comments>
		<pubDate>Fri, 01 May 2009 15:35:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[nant]]></category>
		<category><![CDATA[Ncover]]></category>
		<category><![CDATA[nunit]]></category>

		<guid isPermaLink="false">http://www.gigpeppers.com/blog/?p=38</guid>
		<description><![CDATA[Getting NCover to work with nant builds was more messy than I assumed. What&#8217;s more appalling about all this is that programmers new to NCover download it from the default NCover landing page, only to find that its a paid version(3)(version 1.5 is sufficient for most use cases and serves most of the purposes.) Another [...]<p><a href="http://www.gigpeppers.com/blog/2009/05/01/integrating-ncover-15-with-nant-builds/">Integrating NCover 1.5 with Nant builds</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>



No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Getting <a href="http://www.ncover.com/" target="_blank">NCover</a> to work with nant builds was more messy than I assumed. What&#8217;s more appalling about all this is that programmers new to NCover download it from the default NCover landing page, only to find that its a paid version(3)(version 1.5 is sufficient for most use cases and serves most of the purposes.)</p>
<p>Another concern was that most of the the ncover tutorials on the web showed how to test a single unit test assembly even though ncover comes with a <a href="http://www.kiwidude.com/dotnet/doc/NCoverExplorer.NAntTasks/tasks/nunitproject.html" target="_blank">nunitproject</a> nant task to pick out multiple test files(which is the highway case).</p>
<p>Without much further ado, here’s what I did</p>
<p>Download version <a href="http://jabr.googlecode.com/files/NCover-1.5.8.zip" target="_blank">1.5.8 of NCover</a>, v <a href="http://www.kiwidude.com/dotnet/NCoverExplorer-1.4.0.7.zip" target="_blank">1.4 of NCover Explorer</a> and v <a title="NCover Extras" href="http://www.kiwidude.com/dotnet/NCoverExplorer.Extras-1.4.0.5.zip" target="_blank">1.4 of NCover Extras</a></p>
<p>NCover Extras encapsulates the functionalities provided by NCover as a set of nant tasks. This needs to be loaded.Also CoverLib.dll that comes with NCover needs to be registered.</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">&lt;loadtasks assembly=<span style="color: #006080">&quot;${ncover.nant.task.dir}\NCoverExplorer.NAntTasks.dll&quot;</span>/&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">&lt;exec program=<span style="color: #006080">&quot;regsvr32&quot;</span> workingdir=<span style="color: #006080">&quot;${ncover.dir}&quot;</span> commandline=<span style="color: #006080">&quot;/s coverlib.dll&quot;</span>/&gt;</pre>
</p></div>
</div>
<p>Add these lines before the target is called.</p>
<p>Now for the actual task…</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 98.32%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas,&#39;Courier New&#39;,courier,monospace; height: 295px; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">&lt;target name=<span style="color: #006080">&quot;coverage&quot;</span>&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">  &lt;nunitproject project=<span style="color: #006080">&quot;${output.dir}\tests.nunit&quot;</span>&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    &lt;fileset basedir=<span style="color: #006080">&quot;${output.dir}&quot;</span>&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        &lt;include name=<span style="color: #006080">&quot;*.*Test*.dll&quot;</span> /&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">      &lt;/fileset&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">  &lt;/nunitproject&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">  &lt;ncover</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    program=<span style="color: #006080">&quot;${ncover.dir}NCover.Console.exe&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    commandLineExe=<span style="color: #006080">&quot;${nunitconsoleexe.dir}nunit-console-x86.exe&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    logLevel=<span style="color: #006080">&quot;Verbose&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    commandLineArgs=<span style="color: #006080">&quot;${output.dir}\tests.nunit /nodots /nologo&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    verbose=<span style="color: #006080">&quot;true&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    logFile=<span style="color: #006080">&quot;${coverage.reports.dir}/coverage.log&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    workingDirectory=<span style="color: #006080">&quot;${output.dir}&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    coverageFile=<span style="color: #006080">&quot;${coverage.reports.dir}\Unit.Test.Coverage.xml&quot;</span>&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    &lt;assemblies basedir=<span style="color: #006080">&quot;${output.dir}&quot;</span>&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">      &lt;include name=<span style="color: #006080">&quot;CompanyName*.dll&quot;</span> /&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">      &lt;exclude name=<span style="color: #006080">&quot;*.*Test*.dll&quot;</span> /&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    &lt;/assemblies&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  &lt;/ncover&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  &lt;ncoverexplorer</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    program=<span style="color: #006080">&quot;${ncoverexplorer.dir}\NCoverExplorer.Console.exe&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    projectName=<span style="color: #006080">&quot;ProjectName&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    reportType=<span style="color: #006080">&quot;ModuleClassFunctionSummary&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    outputDir=<span style="color: #006080">&quot;${coverage.reports.dir}&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    xmlReportName=<span style="color: #006080">&quot;TestCoverage.xml&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    sort=<span style="color: #006080">&quot;FunctionCoverageDescending&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    htmlReportName=<span style="color: #006080">&quot;TestCoverage.html&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    showExcluded=<span style="color: #006080">&quot;True&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    minimumCoverage=<span style="color: #006080">&quot;80&quot;</span></pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    satisfactoryCoverage=<span style="color: #006080">&quot;80&quot;</span> &gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    &lt;fileset&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">      &lt;include name=<span style="color: #006080">&quot;${coverage.reports.dir}\Unit.Test.Coverage.xml&quot;</span> /&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    &lt;/fileset&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    &lt;exclusions&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">      &lt;exclusion type=<span style="color: #006080">&quot;Assembly&quot;</span> pattern=<span style="color: #006080">&quot;*.Tests&quot;</span> /&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">      &lt;exclusion type=<span style="color: #006080">&quot;Namespace&quot;</span> pattern=<span style="color: #006080">&quot;*.Tests*&quot;</span> /&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    &lt;/exclusions&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  &lt;/ncoverexplorer&gt;</pre>
<p>
      </p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,&#39;Courier New&#39;,courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">&lt;/target&gt;</pre>
</p></div>
</div>
<p>The node with the nunitproject picks all the test dll’s from the output directory and builds a tests.nunit project file. This will be the input to <a href="http://www.nunit.org/index.php" target="_blank">Nunit</a> which NCover will profile.</p>
<p>Digging into the NCover node you’ll see how NCover is being instructed to take pick the assemblies. If you are copying the code verbatim then change the assemblies node to pick your project dll’s and avoid test dll’s(By convention test assemblies are named ProjectName.Tests.dll). The output of this profiling task will be an xml file(Unit.Test.Coverage.xml in this case) which will be the input to NCoverExplorer, to get those fancy html outputs.</p>
<p>Here’s a typical NCover output xml..</p>
<p><a href="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="191" alt="image thumb Integrating NCover 1.5 with Nant builds" src="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image_thumb.png" width="644" align="left" border="0" /></a></p>
<p>The next node ncoverexplorer takes the xml files and builds a html output. Something similar to what&#8217;s shown below. Additionally the attribute <a href="http://www.kiwidude.com/dotnet/doc/NCoverExplorer.NAntTasks/tasks/ncoverexplorer.html" target="_blank">failMinimum</a>(not shown in this case) will fail the build if coverage doesn&#8217;t meet the coverage percentage specified.</p>
<p>Here’s a sample output.</p>
<p><a href="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image_3.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="183" alt="image thumb 3 Integrating NCover 1.5 with Nant builds" src="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image_thumb_3.png" width="644" border="0" /></a></p>
<p>One little quirk I encountered here was using nunit-console.exe instead of nunit-console-x86.exe. My 64 bit Server 2008 build machine rejected the first executable outright since it ran as 64 bit.</p>
<p>What pissed me of in this exercise was the time it took to integrate a seemingly simple open source project. Pretty much the same experience I had dealing with DD-WRT firmware sources. Once the author/company decides to to release a higher version of the project as a paid version or to make money out of the project, they then obfuscate source paths or put in obstacles that deter consumers from downloading those open source versions.</p>
<p>In case of the DD-WRT the source <a href="http://blog.motiwala.com/2008/05/29/tomato-is-in-goodbye-dd-wrt" target="_blank">was hidden inside GB’s of data</a> and in this case the official NCover website removed all the forums and added nag screens asking users to signup(given below) before downloading..</p>
<p><a href="http://www.ncover.com/login" target="_blank"><img class="alignleft" title="image" style="border-top-width: 0pt; display: block; border-left-width: 0pt; border-bottom-width: 0pt; margin-left: auto; margin-right: auto; border-right-width: 0pt" height="143" alt="image 4 Integrating NCover 1.5 with Nant builds" src="http://assets.gigpeppers.com/IntegratingNcover1.5withNantbuilds_DE21/image_4.png" width="244" border="0" /></a></p>
<div class="wlWriterHeaderFooter" style="text-align:left; margin:0px; padding:4px 4px 4px 4px;"><a href="http://www.dotnetkicks.com/kick/?url=http://www.gigpeppers.com/blog/2009/05/01/integrating-ncover-15-with-nant-builds/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.gigpeppers.com/blog/2009/05/01/integrating-ncover-15-with-nant-builds/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt=" Integrating NCover 1.5 with Nant builds" border="0/" title="Integrating NCover 1.5 with Nant builds" /></a></div>
<p><a href="http://www.gigpeppers.com/blog/2009/05/01/integrating-ncover-15-with-nant-builds/">Integrating NCover 1.5 with Nant builds</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p><img src="http://feeds.feedburner.com/~r/Gigpeppers/~4/9JmiemzChZU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gigpeppers.com/blog/2009/05/01/integrating-ncover-15-with-nant-builds/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.gigpeppers.com/blog/2009/05/01/integrating-ncover-15-with-nant-builds/</feedburner:origLink></item>
		<item>
		<title>Targeted Ad’s</title>
		<link>http://feedproxy.google.com/~r/Gigpeppers/~3/espsHExtFwU/</link>
		<comments>http://www.gigpeppers.com/blog/2008/10/12/targeted-ads/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 04:57:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.gigpeppers.com/blog/?p=31</guid>
		<description><![CDATA[Google sure knows the guys who read Slashdot! Targeted Ad&#8217;s is a post from: GigPeppers No related posts. Related posts brought to you by Yet Another Related Posts Plugin.<p><a href="http://www.gigpeppers.com/blog/2008/10/12/targeted-ads/">Targeted Ad&rsquo;s</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>



No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Google sure knows the guys who read Slashdot!</p>
<p><a href="http://assets.gigpeppers.com/TargetedAds_E5B/Slashdotad1.jpg"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="Slashdotad1" src="http://assets.gigpeppers.com/TargetedAds_E5B/Slashdotad1_thumb.jpg" border="0" alt="Slashdotad1 thumb Targeted Ad&rsquo;s" width="499" height="398" /></a></p>
<div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"><a href="http://digg.com/submit?url=http%3a%2f%2fwww.gigpeppers.com%2fblog%2f%3fp%3d31&amp;title=Targeted+Ad%e2%80%99s"><img style="border: 0" title="Digg This" src="http://digg.com/img/badges/100x20-digg-button.png" border="0" alt="100x20 digg button Targeted Ad&rsquo;s" width="100" height="20" /></a></div>
<p><a href="http://www.gigpeppers.com/blog/2008/10/12/targeted-ads/">Targeted Ad&rsquo;s</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p><img src="http://feeds.feedburner.com/~r/Gigpeppers/~4/espsHExtFwU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gigpeppers.com/blog/2008/10/12/targeted-ads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.gigpeppers.com/blog/2008/10/12/targeted-ads/</feedburner:origLink></item>
		<item>
		<title>Migrating to WordPress</title>
		<link>http://feedproxy.google.com/~r/Gigpeppers/~3/8OtEEbPVWqY/</link>
		<comments>http://www.gigpeppers.com/blog/2008/08/18/migrating-to-wordpress/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 04:50:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.gigpeppers.com/blog/?p=13</guid>
		<description><![CDATA[You can’t expect me to write blogengine plugins for Disqus, super cache, cl forms, Akismet etc. Its way too much work from my focus area. Being a lot of guys who understand technology terms like scripting and html I chose to do a source control install rather than those “one click installs”. Primary reason for [...]<p><a href="http://www.gigpeppers.com/blog/2008/08/18/migrating-to-wordpress/">Migrating to WordPress</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>



No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img">
<p class="zemanta-img-attribution"></p></div>
<p>You can’t expect me to write blogengine plugins for Disqus, super cache, cl forms, Akismet etc. Its way too much work from my focus area. <a href="http://commons.wikipedia.org/wiki/Image:Paris_servers_DSC00190.jpg"><img title="An example of server" alt="202px Paris servers DSC00190 Migrating to WordPress" src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/04/Paris_servers_DSC00190.jpg/202px-Paris_servers_DSC00190.jpg" align="left" /></a></p>
<p>Being a lot of guys who understand technology terms like scripting and html I chose to do a source control install rather than those “one click installs”. Primary reason for this is that WordPress comes with a lot of security issues(they being the most popular) and upgrading through svn is a breeze.</p>
<p>Here’s how I did it.</p>
<p>Choose a good hosting provider. Mine’s DreamHost. They will give you ssh access apart from the usual ftp and cpanel stuff.</p>
<p>Create a folder in your root to host your blog (use software like <a title="Putty" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">putty</a> to get into your remote hosting machine).</p>
<p>Assuming that your hosting provider has svn installed (which most of them do), run svn co http://svn.automattic.com/wordpress/tags/2.6.1 . (last dot included). Then go through the <a href="http://codex.wordpress.org/Installing_WordPress" target="_blank">standard installation procedures</a>.</p>
<p>Next time you need to upgrade do a svn up (as always backup everything) and you are done.</p>
<p><strong>Update: </strong>This post has some missing sentences at the top.&#160; </p>
<div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"><a href="http://digg.com/submit?url=http%3a%2f%2fwww.gigpeppers.com%2fblog%2f2008%2f08%2f18%2fmigrating-to-wordpress%2f&amp;title=Migrating+to+WordPress"><img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="100x20 digg button Migrating to WordPress" title="Digg This" border="0" style="border: 0" /></a></div>
<p><a href="http://www.gigpeppers.com/blog/2008/08/18/migrating-to-wordpress/">Migrating to WordPress</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p><img src="http://feeds.feedburner.com/~r/Gigpeppers/~4/8OtEEbPVWqY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gigpeppers.com/blog/2008/08/18/migrating-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.gigpeppers.com/blog/2008/08/18/migrating-to-wordpress/</feedburner:origLink></item>
		<item>
		<title>Buildings</title>
		<link>http://feedproxy.google.com/~r/Gigpeppers/~3/cILSwiao9Ow/</link>
		<comments>http://www.gigpeppers.com/blog/2008/08/17/buildings/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 07:10:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.gigpeppers.com/blog/2008/08/17/buildings/</guid>
		<description><![CDATA[buildings Originally uploaded by alainlm A picture like this can take you a long way.. Buildings is a post from: GigPeppers No related posts. Related posts brought to you by Yet Another Related Posts Plugin.<p><a href="http://www.gigpeppers.com/blog/2008/08/17/buildings/">Buildings</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>



No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
<a href="http://www.flickr.com/photos/alainlm/2769510069/" title="photo sharing"><img src="http://farm4.static.flickr.com/3048/2769510069_29e4d7037e_m.jpg" alt="2769510069 29e4d7037e m Buildings" style="border: solid 2px #000000;" title="Buildings" /></a><br />
<br />
<span style="font-size: 0.9em; margin-top: 0px;"><br />
<a href="http://www.flickr.com/photos/alainlm/2769510069/">buildings</a><br />
<br />
Originally uploaded by <a href="http://www.flickr.com/people/alainlm/">alainlm</a><br />
</span>
</div>
<p>A picture like this can take you a long way..<br />
<br clear="all" /></p>
<p><a href="http://www.gigpeppers.com/blog/2008/08/17/buildings/">Buildings</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p><img src="http://feeds.feedburner.com/~r/Gigpeppers/~4/cILSwiao9Ow" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gigpeppers.com/blog/2008/08/17/buildings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.gigpeppers.com/blog/2008/08/17/buildings/</feedburner:origLink></item>
		<item>
		<title>Enum with attributes</title>
		<link>http://feedproxy.google.com/~r/Gigpeppers/~3/sKk2GScZGcg/</link>
		<comments>http://www.gigpeppers.com/blog/2008/07/06/enum-attributes/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 19:08:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.gigpeppers.com/blog/?p=3</guid>
		<description><![CDATA[Recently I came across an implementation where enum is converted to string and vice versa (http://blogs.msdn.com/tims/archive/2004/04/02/106310.aspx ). The disadvantage here is that, say you want get the string for something like this “Not available”. enum Status { Not_Available, Available_For_Game, Available_For_Discussion } The string conversion here for the first one would yield Not_Available. This is not [...]<p><a href="http://www.gigpeppers.com/blog/2008/07/06/enum-attributes/">Enum with attributes</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>



No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Recently I came across an implementation where enum is converted to string and vice versa (<a href="http://blogs.msdn.com/tims/archive/2004/04/02/106310.aspx">http://blogs.msdn.com/tims/archive/2004/04/02/106310.aspx</a> ). The disadvantage here is that, say you want get the string for something like this “Not available”. </p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">enum</span> Status {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">  Not_Available, </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  Available_For_Game, </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">  Available_For_Discussion</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">}</pre>
</p></div>
</div>
<p>The string conversion here for the first one would yield Not_Available. This is not desirable in some cases where you don’t want the “_”. A better implementation would be to create attributes to this enum and then extract this. </p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.75%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; height: 236px; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">&#160;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">  <span style="color: #0000ff">public</span> <span style="color: #0000ff">enum</span> Status {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    [Status(Description = <span style="color: #006080">&quot;Not Available&quot;</span>)]      </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    Not_Available = 1,      </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    [Status(Description = <span style="color: #006080">&quot;Available For Game&quot;</span>)] </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    Available_For_Game = 2,      </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    [Status(Description = <span style="color: #006080">&quot;Available For Discussion&quot;</span>)] </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    Available_For_Discussion = 3,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">  <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StatusEnumInfo {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    <span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> StatusAttribute[] edesc; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> String GetDescription(<span style="color: #0000ff">object</span> e)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">      System.Reflection.FieldInfo f = e.GetType().GetField(e.ToString()); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">      StatusEnumInfo.edesc = f.GetCustomAttributes(<span style="color: #0000ff">typeof</span>(StatusAttribute), <span style="color: #0000ff">false</span>) <span style="color: #0000ff">as</span> StatusAttribute[]; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">      <span style="color: #0000ff">if</span> (StatusEnumInfo.edesc != <span style="color: #0000ff">null</span> &amp;&amp; StatusEnumInfo.edesc.Length == 1)         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        <span style="color: #0000ff">return</span> StatusEnumInfo.edesc[0].Description; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">      <span style="color: #0000ff">else</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        <span style="color: #0000ff">return</span> String.Empty;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    } </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">object</span> GetEnumFromDesc(Type t, <span style="color: #0000ff">string</span> desc)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">      Array x = Enum.GetValues(t); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">      <span style="color: #0000ff">foreach</span> (<span style="color: #0000ff">object</span> o <span style="color: #0000ff">in</span> x) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        <span style="color: #0000ff">if</span> (GetDescription(o).Equals(desc)) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">          <span style="color: #0000ff">return</span> o;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">      } <span style="color: #0000ff">return</span> String.Empty;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">  }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StatusAttribute : Attribute {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    <span style="color: #0000ff">public</span> String Description { get; set; }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">&#160;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Implemenation {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Run()</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">      Status statusEnum = (Status)StatusEnumInfo.GetEnumFromDesc(<span style="color: #0000ff">typeof</span>(Status), <span style="color: #006080">&quot;Not Available&quot;</span>); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">      String statusString = StatusEnumInfo.GetDescription(Status.Available_For_Discussion);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  }</pre>
</p></div>
</div>
<p>You are of course free to generalize this. Correct me if this is not a correct implementation.<a href="http://11011.net/software/vspaste"></a></p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:054afadb-0db1-498e-a0a2-98baf136534d" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/C%23" rel="tag">C#</a>,<a href="http://technorati.com/tags/Tech" rel="tag">Tech</a></div>
<div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"><a href="http://digg.com/submit?url=http%3a%2f%2fwww.gigpeppers.com%2fblog%2f%3fp%3d3&amp;title=Enum+with+attributes"><img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="100x20 digg button Enum with attributes" title="Digg This" border="0" style="border: 0" /></a></div>
<p><a href="http://www.gigpeppers.com/blog/2008/07/06/enum-attributes/">Enum with attributes</a> is a post from: <a href="http://www.gigpeppers.com/blog">GigPeppers</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p><img src="http://feeds.feedburner.com/~r/Gigpeppers/~4/sKk2GScZGcg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gigpeppers.com/blog/2008/07/06/enum-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.gigpeppers.com/blog/2008/07/06/enum-attributes/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 4.834 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-02-05 12:02:36 -->

