<?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>Dataplex Technology Solutions Blog &#187; .NET</title>
	<atom:link href="http://dataplex.org/blog/category/programming/dotnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://dataplex.org/blog</link>
	<description>Web Development, Network Administration, Informaton Security</description>
	<lastBuildDate>Wed, 24 Aug 2011 15:36:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ASP.NET MVC AJAX RedirectToAction</title>
		<link>http://dataplex.org/blog/2009/11/asp-net-mvc-ajax-redirecttoaction/</link>
		<comments>http://dataplex.org/blog/2009/11/asp-net-mvc-ajax-redirecttoaction/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 19:26:11 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ajax.beginform]]></category>
		<category><![CDATA[redirecttoaction]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=211</guid>
		<description><![CDATA[I had a problem recently in an application I was writing where I popped up a dialog box (jQuery Dialog) with a registration partial view. Once the user successfully registered, I checked to see if the request was an ajax request (Request.IsAjaxRequest()) and returned RedirectToAction to go to the home page. However, what ended up [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/11/asp-net-mvc-ajax-redirecttoaction/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/11/asp-net-mvc-ajax-redirecttoaction/"></fb:send></div><p>I had a problem recently in an application I was writing where I popped up a dialog box (jQuery Dialog) with a registration partial view. Once the user successfully registered, I checked to see if the request was an ajax request (Request.IsAjaxRequest()) and returned RedirectToAction to go to the home page. However, what ended up happening was this result was being shown in the Dialog box. As you can imagine, it was the full front page in the dialog, on top of the front page.</p>
<p>This was happening because the Ajax.BeginForm AjaxOptions UpdateTargetId was set and the result was being forced into that element regardless of the type of action being returned. To get around this I first returned a PartialRegistrationSuccess view that just said &#8220;Registration Successful. Please close this window and login&#8221;. I wasn&#8217;t very happy with this because without the AJAX request, the user was automatically logged in.</p>
<p>What I ended up doing was returning a partial login view that had a normal form on it (Html.BeginForm). This way, when the user logged in through the dialog box, the full page was redirected back to the home page on success, or a full login page on failure. This is much more graceful than the registration success message.</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/11/asp-net-mvc-ajax-redirecttoaction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extracting MSI Files Locally to Avoid Install</title>
		<link>http://dataplex.org/blog/2009/08/extracting-msi-files-locally-to-avoid-install/</link>
		<comments>http://dataplex.org/blog/2009/08/extracting-msi-files-locally-to-avoid-install/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 15:12:19 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=203</guid>
		<description><![CDATA[I use a lot of tools in my .NET development projects that I like to keep in my source control repository so all developers have the same version and mostly the same configuration. I do set up my projects so these can generally be overridden, but the build system uses the ones I keep in [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/08/extracting-msi-files-locally-to-avoid-install/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/08/extracting-msi-files-locally-to-avoid-install/"></fb:send></div><p>I use a lot of tools in my .NET development projects that I like to keep in my source control repository so all developers have the same version and mostly the same configuration. I do set up my projects so these can generally be overridden, but the build system uses the ones I keep in the repository for standards sake.</p>
<p>Recently I&#8217;ve been seeing a lot of tools released (specifically from Microsoft) that only come in .msi format. I don&#8217;t like this because it means I either have to install the msi (which then makes the tool dependent on my platform), or I have to extract the files and add them manually to my repository.</p>
<p>A quick Google search for &#8220;extracting msi files&#8221; revealed a really nice blog post <a href="http://thebackroomtech.com/2007/08/23/howto-extract-files-from-a-msi-file-using-the-windows-command-line/">Howto: extract files from a .msi file using the Windows command line</a> . Go there and learn how to extract MSI files and then add them manually to a tools repository and link externally to this repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/08/extracting-msi-files-locally-to-avoid-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows XP 64-bit with IIS 6 and ASP.NET 2.0 Websites</title>
		<link>http://dataplex.org/blog/2009/06/windows-xp-64-bit-with-iis-6-and-aspnet-20-websites/</link>
		<comments>http://dataplex.org/blog/2009/06/windows-xp-64-bit-with-iis-6-and-aspnet-20-websites/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 19:44:50 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=192</guid>
		<description><![CDATA[I had a hard time getting IIS 6 on my newly reformatted Windows XP Professional 64-bit to serve up ASP.NET applications. IIS was not installed by default, so I installed it through the normal control panel operations. Then I ran aspnet_regiis -ir, and figured that was that. When I added a virtual directory on the [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/06/windows-xp-64-bit-with-iis-6-and-aspnet-20-websites/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/06/windows-xp-64-bit-with-iis-6-and-aspnet-20-websites/"></fb:send></div><p>I had a hard time getting IIS 6 on my newly reformatted Windows XP Professional 64-bit to serve up ASP.NET applications. IIS was not installed by default, so I installed it through the normal control panel operations. Then I ran aspnet_regiis -ir, and figured that was that. When I added a virtual directory on the default site, I assigned the document root to where my ASP.NET website was located. When I went to the page however, it gave me a 404.</p>
<p>After searching around the internet for a while, I ran across a <a href="http://www.claassen.net/geek/blog/2008/03/xp-64-iis-6-and-aspnet.html">blog post at ILoggable</a> about the issue. You have to go into IIS Manager and enable ASP.NET v2.0 as a Web Service Extension. After that, everything worked fine!</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/06/windows-xp-64-bit-with-iis-6-and-aspnet-20-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Linq to Ease XML Creation/Parsing</title>
		<link>http://dataplex.org/blog/2009/04/using-linq-to-ease-xml-creationparsing/</link>
		<comments>http://dataplex.org/blog/2009/04/using-linq-to-ease-xml-creationparsing/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 20:34:50 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=190</guid>
		<description><![CDATA[I am currently working on a Test Driven Development (TDD) Flickr API library in .NET. There already exists a FlickrNet library that is written in .NET, but it was written without using TDD and is very tightly coupled to the methods that send requests to flickr. I&#8217;ve tried refactoring the library but it just isn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/04/using-linq-to-ease-xml-creationparsing/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/04/using-linq-to-ease-xml-creationparsing/"></fb:send></div><p>I am currently working on a Test Driven Development (TDD) Flickr API library in .NET. There already exists a FlickrNet library that is written in .NET, but it was written without using TDD and is very tightly coupled to the methods that send requests to flickr. I&#8217;ve tried refactoring the library but it just isn&#8217;t easy.</p>
<p>Instead I&#8217;m writing my own that I will share with others that is TDD driven. But that isn&#8217;t what this article is about. I&#8217;m writing today about Linq-to-Xml. Linq is basically an ORM technology for abstracting queries. You typically query a lot of data in programming such as XML, databases, files, and collections of information.</p>
<p>Linq allows you to look inside that data and pull out only what you need without having to write parsing methods. This is a gross over simplification of the process, but you can always read more at MSDN.</p>
<p>So why am I bringing this up? Well, the Flickr REST responses are all XML, so naturally my library has to do a lot of XML parsing. To test XML parsing, I have to pass in a bunch of XML somewhere, parse it  in my classes, and then do assertions that the objects I get back contain the same data that I sent in.</p>
<p>Originally my tests were looking something like this (FlickrBlogTests.cs):</p>
<p>[Test]<br />
public void GetList_Returns_List_Of_Blogs() {<br />
FlickrBlog blog1 = new FlickrBlog() { Id = &#8220;72&#8243;, Name = &#8220;Test Blog 1&#8243;, NeedsPassword = true, Url = &#8220;http://testblog1.com&#8221; };<br />
string rawBlogResponse = &#8220;&lt;blogs&gt;&lt;blog id=\&#8221;" + blog1.Id + &#8220;\&#8221; name=\&#8221;" + blog1.Name +&#8221;\&#8221; &#8230; /&gt;&lt;/blogs&gt;&#8221;;<br />
List&lt;FlickrBlog&gt; blogs = FlickrBlogs.GetList();<br />
Assert.That(blogs[0].Id, Is.EqualTo(blog1.Id));<br />
}</p>
<p>Now, I started my actual code using Linq, so you will already see how Linq will come in handy. In the actual FlickrBlogs class code, I have a parse method like this:</p>
<p>private List&lt;FlickrBlog&gt; ParseResponseForBlogs(FlickrResponse response)<br />
{<br />
XDocument doc = XDocument.Load(new StringReader(response.RawData));<br />
var query = from blog in doc.Elements(&#8220;blogs&#8221;).Elements(&#8220;blog&#8221;)<br />
select new FlickrBlog<br />
{<br />
Id = blog.Attribute(&#8220;id&#8221;).Value,<br />
Name = blog.Attribute(&#8220;name&#8221;).Value,<br />
NeedsPassword = Convert.ToBoolean(blog.Attribute(&#8220;needspassword&#8221;).Value),<br />
Url = blog.Attribute(&#8220;url&#8221;).Value<br />
};<br />
return query.ToList();<br />
}</p>
<p>As you can tell, the test code is pretty shameful and difficult to change and test with. The FlickrBlogs code isn&#8217;t bad and it&#8217;s readable. Introducing Linq as a way to clean the test up:</p>
<p>[Test]<br />
public void GetList_Correctly_Parses_Xml_Blog_Return()<br />
{<br />
FlickrBlog blog1 = new FlickrBlog() { Id = &#8220;73&#8243;, Name = &#8220;Bloxus Test&#8221;, NeedsPassword = true, Url = &#8220;http://remote.bloxus.com&#8221; };<br />
FlickrBlog blog2 = new FlickrBlog() { Id = &#8220;74&#8243;, Name = &#8220;Test Blog 2&#8243;, NeedsPassword = false, Url = &#8220;http://testblog2.com&#8221; };<br />
XDocument doc = new XDocument(<br />
new XElement(&#8220;blogs&#8221;,<br />
new XElement(&#8220;blog&#8221;,<br />
new XAttribute(&#8220;id&#8221;, blog1.Id),<br />
new XAttribute(&#8220;name&#8221;, blog1.Name),<br />
new XAttribute(&#8220;needspassword&#8221;, blog1.NeedsPassword == true ? &#8220;1&#8243; : &#8220;0&#8243;),<br />
new XAttribute(&#8220;url&#8221;, blog1.Url)<br />
),<br />
new XElement(&#8220;blog&#8221;,<br />
new XAttribute(&#8220;id&#8221;, blog2.Id),<br />
new XAttribute(&#8220;name&#8221;, blog2.Name),<br />
new XAttribute(&#8220;needspassword&#8221;, blog2.NeedsPassword == true ? &#8220;1&#8243; : &#8220;0&#8243;),<br />
new XAttribute(&#8220;url&#8221;, blog2.Url)<br />
)<br />
)<br />
);</p>
<p>List&lt;FlickrBlog&gt; inputblogs = new List&lt;FlickrBlog&gt;();<br />
inputblogs.Add(blog1);<br />
inputblogs.Add(blog2);</p>
<p>FlickrResponse response = new FlickrResponse(FlickrResponseStatus.OK, doc.ToString());<br />
commstub.Response = response;<br />
List&lt;FlickrBlog&gt; blogs = flickr.Blogs.GetList();</p>
<p>Assert.That(commstub.Request.MethodName, Is.EqualTo(FlickrMethods.Blogs.GetList));<br />
Assert.That(Is.Equals(blog1, blogs[0]));<br />
Assert.That(Is.Equals(blog2, blogs[1]));<br />
}<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/04/using-linq-to-ease-xml-creationparsing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts and Tangents on Programming Frameworks</title>
		<link>http://dataplex.org/blog/2009/04/thoughts-and-tangents-on-programming-frameworks/</link>
		<comments>http://dataplex.org/blog/2009/04/thoughts-and-tangents-on-programming-frameworks/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 23:08:32 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[Business Administration]]></category>
		<category><![CDATA[Politics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[management]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=187</guid>
		<description><![CDATA[Robert Stackhouse wrote an excellent article on his blog titled Frameworks as a Means of Creating Transferrable Expertise. I started writing a response in the comments and ended up going off on quite a tangent. Thus, I&#8217;ve reposted parts of his article and my responses here, as well as some followup dialog. It almost seems [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/04/thoughts-and-tangents-on-programming-frameworks/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/04/thoughts-and-tangents-on-programming-frameworks/"></fb:send></div><p>Robert Stackhouse wrote an excellent article on his blog titled <a href="http://robertstackhouse.com/2009/04/06/frameworks-as-a-means-of-creating-transferrable-expertise">Frameworks as a Means of Creating Transferrable Expertise</a>. I started writing a response in the comments and ended up going off on quite a tangent. Thus, I&#8217;ve reposted parts of his article and my responses here, as well as some followup dialog.</p>
<blockquote><p>It almost seems as if Microsoft and Sun and every other Framework author out there in the world figured out that training people is expensive, so let’s build a framework to reduce the cost of that training. It is much easier to spoon feed people than to teach them to think for themselves. Microsoft even went one step further and said, “Let’s go one better and try to get the poor schlep who doesn’t have 5 years experience to try to pay for the training themselves;let’s create a certification program.”</p></blockquote>
<p>The alternative to Microsoft and Sun developing enterprise frameworks as large as .NET and Java is to have people still writing buffer overflows and string format vulnerabilities in C/C++. These frameworks have the huge benefit of making more secure code in many cases, as well as making it feasible for companies to even hire developers full time. If they figure that frameworks cut down development time, they are more likely to invest the money in IT in the first place, thus creating jobs for all of us.</p>
<p>I hardly think training is the issue here. If I had to chose between training someone to the point of proficiency in either .NET/Java or C/C++, I would chose a framework in a heartbeat. The time it would take for entry level programmers to learn C/C++ and the figure out how to be secure and develop worthwhile code would be prohibitive at best, and outright unfeasible at worst.</p>
<p>Certifications make sure people have basic skills and can as they claim. It all depends on the difficulty of the certification. I wouldn&#8217;t put much stock in someone with an MCP and little experience. Someone with an MCSD however I would give more attention, even if the relative experience wasn&#8217;t equal. The same goes for any IT sector &#8211; look at the Security+ (entry level) and the CISSP (serious professional).</p>
<blockquote><p>Why is it that the same people who will ask every friend they have who the best mechanic in town is (instead of going straight to the Toyota dealer) will trust the word of a Microsoft certification over the word of a developer’s brethren or even his own code?</p></blockquote>
<p>Again, this is context driven. Looking for a mechanic is a personal endevour that is something almost everyone deals with. Looking for a developer for a corporation is a different context entirely. By the same token, did you know that most of those dealerships won&#8217;t hire mechanics who don&#8217;t carry their companies certifications? Ford dealerships typically <a href="http://education-portal.com/articles/Ford_Mechanic:_Career_Profile.html">require a certification</a> before they hire mechanics.</p>
<p>It again boils down to something akin to &#8220;you can at least perform at the minimum level we require, and we can teach you our development culture.&#8221; No two software projects are alike, but .NET is .NET, regardless of where it is used.</p>
<blockquote><p>Granted not every development shop (even some of the ones who use Microsoft.NET) think this way. The only question is: would you rather have an employee who spends all day programing around the framework, or one that knows when to ditch the framework and look for another one or god forbid roll something from scratch?</p></blockquote>
<p>The ones who know by instinct to ditch a framework for a more appropriate technology have most likely moved up the chain to a team lead position or management. I think we do have the problem of developers moving into management without having proper communication and management skills. We would almost never take a manager and say automatically that they would make a good developer, so why do we assume the opposite is true? Until our industry learns how to justify our software in the same manner that a machinist justifies a new lathe, we will always have this problem. I&#8217;ve seen this more times than I care to remember.</p>
<blockquote><p>I also don’t really think we should be trying to optimize costs at a human level. Why don’t we instead invest in our employees, train them, and who knows maybe even wind up with a person who doesn’t hesitate to think for themselves and a little workplace loyalty in the end?</p></blockquote>
<p>Again, look at it in context. Cost optimization at a human level goes on in every industry, not just software development. The salesman who sells two contracts a month will be replaced if he&#8217;s being compared to salesmen who sell 10 contracts a month. Can you guarantee that training him will ever pay off? This is the whole existance of HR and reorganization consultants. If you choose to ignore this area of optimization the organization may not recover and all the jobs will go away.</p>
<p>&#8230;all that being said, I agree that frameworks are not the holy grail. I think fast, core frameworks are the start and extensions to those are the way to go. There are jobs out there completely based on using things like Telerik controls, or Infragistics controls. These are build on top of a nice, extensible framework and they serve a purpose and create jobs. A company that would not be willing to develop that control themselves will be willing to pay for it and talent that can put it to efficient use for their purposes.</p>
<p>We are also still considered in the same boat as infrastructure services, which are not the same as software development. This is a fundamental flaw in my opinion. There are infrastructures (routers, servers, cabling, power) that is necessary AND a cost center. But software development produces &#8220;tangible&#8221; goods that can be used as a profit generator or at the very least an optimization of processes.</p>
<p>These are very different areas of IT but management still doesn&#8217;t separate them. We are getting closer with the advent of seperation between CIO/CTO, but few companies hire both. They are typically considered interchangable by uninformed upper management. Some even still put the CIO under the Finance department because they are seen as a cost center.</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/04/thoughts-and-tangents-on-programming-frameworks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reusing Tools From Subversion Controlled Directories</title>
		<link>http://dataplex.org/blog/2009/02/reusing-tools-from-subversion-controlled-directories/</link>
		<comments>http://dataplex.org/blog/2009/02/reusing-tools-from-subversion-controlled-directories/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 19:12:28 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[AgileBCS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[reuse]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=156</guid>
		<description><![CDATA[Sometimes I want to take a tool from one project that is under subversion and use it in another. The problem is with the existing .svn directories. Because the files are already in one repository, copying directly from there to another project will cause conflicts in the other repository. There are quick and easy ways [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/02/reusing-tools-from-subversion-controlled-directories/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/02/reusing-tools-from-subversion-controlled-directories/"></fb:send></div><p>Sometimes I want to take a tool from one project that is under subversion and use it in another. The problem is with the existing .svn directories. Because the files are already in one repository, copying directly from there to another project will cause conflicts in the other repository.</p>
<p>There are quick and easy ways to solve this in both Windows and Linux. To get around this in Windows copy the directory to a temporary folder and use Windows find to search the directory for &#8220;.svn&#8221; and delete all the directories it finds. From there just move the folder to the new project and add it to source control.</p>
<p>On Linux it is even easier. Copy the folder to a temporar location and run &#8220;find . -type d -name .svn -exec rm -rf {}\;&#8221; . This will delete all .svn directories. Then move the tool directory to your new project and add it to source control.</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/02/reusing-tools-from-subversion-controlled-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started with Basic Agile Development &#8211; The Technical</title>
		<link>http://dataplex.org/blog/2009/02/getting-started-with-basic-agile-development-the-technical/</link>
		<comments>http://dataplex.org/blog/2009/02/getting-started-with-basic-agile-development-the-technical/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 04:11:00 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[AgileBCS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[NAnt]]></category>
		<category><![CDATA[nunit]]></category>
		<category><![CDATA[phpundercontrol]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[test driven development]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=154</guid>
		<description><![CDATA[I recently helped a friend out with the technical side of going &#8220;agile&#8221;. This meant setting up some project source control and automation for build and test. I have a pretty advanced automation setup on most of my projects right now. It&#8217;s far from perfect (I don&#8217;t have nightly releases being tagged, etc), but it [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/02/getting-started-with-basic-agile-development-the-technical/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/02/getting-started-with-basic-agile-development-the-technical/"></fb:send></div><p>I recently helped a friend out with the technical side of going &#8220;agile&#8221;. This meant setting up some project source control and automation for build and test. I have a pretty advanced automation setup on most of my projects right now.  It&#8217;s far from perfect (I don&#8217;t have nightly releases being tagged, etc), but it gets the job done. But I sometimes forget how long it&#8217;s taken me to learn the lessons and get things set up correctly (AFAIK &#8211; I&#8217;m no expert). I may be missing a lot but I always try to improve what I&#8217;m doing and review it often for lessons learned.</p>
<p>As I said previously I had about 2 hours with my friend to set up an automated build, and teach him the virtues of Test Driven Development and Continuous Integration. We set up a project with a simple NAnt build file that had the basic targets &#8211; init, clean, compile, test, and build &#8211; and then got into some code with a 3 tier project (presentation, BLL, DAL) and a test project. This all went well and he caught on quickly which was nice. I sometimes have a hard time teaching things because the ideas are so ingrained into me that they are difficult to explain to others.</p>
<p>I raised a red flag with him because he was trying to introduce a lot of new technology at once. I asked him to really think about which technologies he wanted to implement and get started with. The obvious ones to start with are automated build (Ant/NAnt), unit testing (PHPUnit/NUnit), and Continuous Integration (phpUnderControl/CruiseControl.NET). Beyond this I asked him to wait until he was comfortable with these before adding things like an ORM he was unfamiliar with.</p>
<p>One of the worst things to do is jump into a new project with 100% new technologies that first have to be learned. We always want to play with the latest and greatest and there&#8217;s a good reason for many of them to exist. But taking on too much at once and not coming away with a good understanding of any of the technologies can also be harmful. Pick your new technologies for the value they will bring, not for the coolness factor.</p>
<p>The other side of this coin is that with a good automated build, testing, and continuous integration, later down the line it is much easier to introduce these new technologies that may have real benefits. Your code will be much more flexible, and your team will be much more comfortable switching out older technologies for new ones because the tests will tell the truth. And with a good source control setup, you can always branch new technology development and merge it later if the team deems it worthy enough to add into the mainline development.</p>
<p>I would like to write up a series of posts covering the very basics of the technical side of agile, with this post being the first. Agile development encompasses everything from technical issues  to management to customer interaction. It can be difficult to jump into without knowing the how or the why of each part. There are also several different ways to implement agile development. But it is often easy to start with simple and sound technical practices. A grass roots technical movement can have a great effect on changing a teams culture. And, it&#8217;s usually easier to ask for forgiveness than permission, and definitely easier to ask for it when your project is wildly successful because of some small steps taken in the right direction.</p>
<p>Another good way to get involved with agile development is to find a local user group or a development shop that may be willing to have regular meetings with you to show you the ropes and review what you&#8217;re doing. My office has been good about allowing me to do this through community training and user group interaction. Part of the reason for this is that my projects are on sound foundations and they value the fact that I don&#8217;t waste time developing terrible code&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/02/getting-started-with-basic-agile-development-the-technical/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing NAnt 0.86 Beta 1 for .NET 3.5 Continuous Integration</title>
		<link>http://dataplex.org/blog/2009/01/fixing-nant-086-beta-1-for-net-35-continuous-integration/</link>
		<comments>http://dataplex.org/blog/2009/01/fixing-nant-086-beta-1-for-net-35-continuous-integration/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 19:32:55 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[build server]]></category>
		<category><![CDATA[cruise control]]></category>
		<category><![CDATA[NAnt]]></category>
		<category><![CDATA[nant registry hack]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[windows sdk]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=92</guid>
		<description><![CDATA[I recently had a little problem with my build scripts on my CI server. Since I have Visual Studio 2008 installed on my development machine, NAnt finds the Windows SDK v6.0A installed (flack from the VS2k8 install) and runs along happily building .NET 3.5 libraries (where I use WCF for SOA layers). However, when I [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/01/fixing-nant-086-beta-1-for-net-35-continuous-integration/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/01/fixing-nant-086-beta-1-for-net-35-continuous-integration/"></fb:send></div><p>I recently had a little problem with my build scripts on my CI server. Since I have Visual Studio 2008 installed on my development machine, NAnt finds the Windows SDK v6.0A installed (flack from the VS2k8 install) and runs along happily building .NET 3.5 libraries (where I use WCF for SOA layers). However, when I recently created a new build server without installing Visual Studio, I kept getting these errors about the sdkInstallRoot not being found for net-3.5. I went ahead and downloaded and installed the latest Windows SDK for Vista (v6.1), but it had no effect on the build scripts.<span id="more-92"></span></p>
<p>I started digging into the blogosphere and found <a title="Nant Setup for Visual Studio 2008 and .net 3.5" href="http://www.timbarcz.com/blog/CategoryView,category,Nant.aspx" target="_blank">an article by Tim Barcz</a> describing how to fix NAnt for .NET 3.5. This lead me to doing a little poking around in the NAnt.exe.config file, and I found the following registry key search:</p>
<blockquote><p>&lt;readregistry<br />
property=&#8221;sdkInstallRoot&#8221;<br />
key=&#8221;SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A\WinSDKNetFxTools\InstallationFolder&#8221;<br />
hive=&#8221;LocalMachine&#8221;<br />
failonerror=&#8221;false&#8221; /&gt;</p></blockquote>
<p>The funny thing about that registry key is that it exists when you install Visual Studio, but not when you install the latest SDK. I did not want to alter the config file because on developer machines in a large team, you&#8217;re more likely to see Visual Studio installed than not. The above registry key is found then, and everything works. But for a build server where the basics are installed (CruiseControl.NET, Subversion, and the Windows SDK v6.1), this doesn&#8217;twork out so well.</p>
<p>What I ended up doing was creating a registry key on the build server that mimiced the above key, but actually pointed to the 6.1 SDK. Once NAnt can find the installed SDK path, it actually links to the proper libraries (usually found in C:\Windows\Micrsoft.NET\Framework\v3.5 and v3.0 respectively). This keeps the NAnt config file the same, thus sparing developers from having to modify their registry, and fixes the build server so it can compile against .NET 3.0 and 3.5 libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/01/fixing-nant-086-beta-1-for-net-35-continuous-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating Code Review Tools &#8211; FxCop &#8211; Part III</title>
		<link>http://dataplex.org/blog/2009/01/automating-code-review-tools-fxcop-part-iii/</link>
		<comments>http://dataplex.org/blog/2009/01/automating-code-review-tools-fxcop-part-iii/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 22:39:39 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[code reviews]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[FxCop]]></category>
		<category><![CDATA[NAnt]]></category>
		<category><![CDATA[nant contrib]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=90</guid>
		<description><![CDATA[The third post in this series on Automating Code Review tools will cover FxCop. FxCop is a coding standard and introspective analysis tool that looks at code using a ruleset and analyzes things such as code design (&#8220;should this method be static, internal, etc&#8221;) and performance (&#8220;change this method to static because it never uses [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/01/automating-code-review-tools-fxcop-part-iii/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/01/automating-code-review-tools-fxcop-part-iii/"></fb:send></div><p>The third post in this series on Automating Code Review tools will cover <a title="Learn about FxCop from Microsoft" href="http://msdn.microsoft.com/en-us/library/bb429476(vs.80).aspx" target="_blank">FxCop</a>. FxCop is a coding standard and introspective analysis tool that looks at code using a ruleset and analyzes things such as code design (&#8220;should this method be static, internal, etc&#8221;) and performance (&#8220;change this method to static because it never uses the &#8216;this&#8217; member&#8221;).</p>
<p>I have added FxCop to the automation on several projects I run and found out the hard way just what Microsoft thinks of my code. Actually, there were not a lot of code errors that were show stoppers. Most of the errors came from the Microsoft.Design and Microsoft.Performance rule sets of FxCop. I also had a strong naming error on all my libraries, which I fixed with some quick public/private keypair generation tools (more on this later).</p>
<p>So today&#8217;s post is about automating FxCop and fixing some of the likely rule violations you are going to see in your output. You can also follow the FxCop Blog at http://blogs.msdn.com/fxcop/.</p>
<p><span id="more-90"></span><strong>FxCop Setup and NAntContrib</strong></p>
<p>The first thing to do is <a title="Download FxCop from code.msdn.microsoft.com" href="http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=codeanalysis&amp;ReleaseId=553" target="_blank">download and install FxCop</a>. FxCop is only available as an executable so you have to install it first and then copy the files it puts in the installation path you specify to your project&#8217;s tools directory. This process is pretty straight forward and there are no other dependencies you have to resolve to get FxCop working from your project repository without having it installed on the development computer you are working on.</p>
<p>The second thing to do (if you haven&#8217;t already) is <a title="Visit NAntContrib Homepage" href="http://nantcontrib.sourceforge.net/" target="_blank">download and install NAntContrib</a>. NAntContrib contains a lot of useful tasks that NAnt does not, including the fxcop task. In my project&#8217;s repository I have FxCop in ${root.dir}\tools\FxCop and NAntContrib in ${root.dir}\tools\NAntContrib.</p>
<p><strong>NAnt Build File Setup</strong></p>
<p>First you have to make the NAntContrib tasks available to your build files. I use properties to specify paths in my projects so I can reuse them in submodules of my project. For this example, we will assume you have set these up, along with the properties set below. The following should be put at the top of your build right under the project element:</p>
<blockquote><p>&lt;property name=&#8221;root.dir&#8221; value=&#8221;.&#8221; /&gt;<br />
&lt;property name=&#8221;build.dir&#8221; value=&#8221;${root.dir}\build&#8221; /&gt;<br />
&lt;property name=&#8221;tools.dir&#8221; value=&#8221;${root.dir}\tools&#8221; /&gt;<br />
&lt;property name=&#8221;tools.nantcontrib.dir&#8221; value=&#8221;${tools.dir}\NAntContrib&#8221; /&gt;<br />
&lt;property name=&#8221;tools.fxcop.dir&#8221; value=&#8221;${tools.dir}\fxcop&#8221; /&gt;</p>
<p>&lt;!&#8211; Load the NAntContrib Tasks &#8211;&gt;<br />
&lt;loadtasks assembly=&#8221;${tools.nantcontrib.dir}\NAnt.Contrib.Tasks.dll&#8221; /&gt;</p></blockquote>
<p><strong>The Build Target</strong></p>
<p>The next thing to do is define a build target that will compile your code. Before I added FxCop, here is what my build target looked like:</p>
<blockquote><p>&lt;target name=&#8221;build&#8221; depends=&#8221;clean,init&#8221; description=&#8221;Compiles the code into a DLL&#8221;&gt;<br />
&lt;property name=&#8221;compile.dir&#8221; value=&#8221;${project::get-name()}.Source&#8221; /&gt;<br />
&lt;csc target=&#8221;library&#8221; output=&#8221;${build.dir}/${compile.dir}.dll&#8221; debug=&#8221;${debug.compile}&#8221;&gt;<br />
&lt;sources&gt;<br />
&lt;include name=&#8221;${compile.dir}/**/*.cs&#8221; /&gt;<br />
&lt;/sources&gt;<br />
&lt;references&gt;<br />
&lt;!&#8211; Put necessary references here &#8211;&gt;<br />
&lt;/references&gt;<br />
&lt;/csc&gt;<br />
&lt;/target&gt;</p></blockquote>
<p><strong>Setting Up the Environment for FxCop<br />
</strong></p>
<p>Since we have loaded NAntContrib, the <a title="Read NantContrib documentation on FxCop task" href="http://nantcontrib.sourceforge.net/release/0.85/help/tasks/fxcop.html" target="_blank">fxcop task</a> is available to us, but we first have to do some setup. The fxcop task assumes that  the FxCop executable (FxCopCmd.exe) is available from somewhere in your PATH environment variable. Since we removed it from Program Files, this is no longer true and we need to add the path to the FxCop directory to our PATH environment variable. We don&#8217;t want this to be permanent however since we don&#8217;t really want to mess with the environment any more than is necessary for our build to run. The following code should be placed under the properties and loadtask stuff we put in our build file earlier:</p>
<p>&lt;!&#8211; FxCop PATH Resolution &#8211;&gt;<br />
&lt;if test=&#8221;${not property::exists(&#8216;setFxCopPath&#8217;)}&#8221;&gt;<br />
&lt;<a title="NAnt setenv documentation" href="http://nant.sourceforge.net/release/0.85/help/tasks/setenv.html" target="_blank">setenv</a> name=&#8221;PATH&#8221; value=&#8221;${<a title="environment get variable documentation" href="http://nant.sourceforge.net/release/0.85/help/functions/environment.get-variable.html" target="_blank">environment::get-variable</a>(&#8216;PATH&#8217;)};${tools.fxcop.dir}&#8221; /&gt;<br />
&lt;property name=&#8221;setFxCopPath&#8221; value=&#8221;true&#8221; /&gt;<br />
&lt;/if&gt;</p>
<p>You don&#8217;t actually need the if statement when using only one build file. I put this in a global properties file that is loaded in each build file. However, I do not want the PATH variable to be inundated with the fxcop directory so I test to see if I&#8217;ve already loaded it or not.</p>
<p><strong>Adding FxCop to Your Build File</strong></p>
<p>The next stop of course is to actually run FxCop on your assemblies and see what happens. So, without further ado, here is the target:</p>
<blockquote><p>&lt;target name=&#8221;fxcop&#8221; depends=&#8221;build&#8221; description=&#8221;Runs the FxCop tool over the set of libraries&#8221;&gt;<br />
&lt;<a title="fxcop task documentation" href="http://nantcontrib.sourceforge.net/release/0.85/help/tasks/fxcop.html" target="_blank">fxcop</a>&gt;<br />
&lt;targets&gt;<br />
&lt;include name=&#8221;${build.dir}\*.dll&#8221; /&gt;<br />
&lt;/targets&gt;<br />
&lt;arg value=&#8221;/out:${reports.dir}\fxcop.xml&#8221; /&gt; &lt;!&#8211; Change the directory where the output is saved  &#8211;&gt;<br />
&lt;arg value=&#8221;/directory:${lib.entlib.dir}&#8221; /&gt; &lt;!&#8211; Look in the entlib directory for supporting libraries used in the project &#8211;&gt;<br />
&lt;!&#8211; &lt;arg value=&#8221;/rid:-Microsoft.Design#CA2210&#8243; /&gt;  &#8211; Example of ignoring a specific rule &#8211; Ignore the Strong Naming Rule &#8211;&gt;<br />
&lt;arg value=&#8221;/fo&#8221; /&gt; &lt;!&#8211; Force output even if there are no violatons &#8211;&gt;<br />
&lt;/fxcop&gt;<br />
&lt;/target&gt;</p></blockquote>
<p>This target is running FxCop on the specified libaries in the build directory. It saves the output file to a specific location (which our CI server can save as an artifact). It also looks in a directory where other used libaries are located (in the case that they aren&#8217;t all in your build directory). Finally, I added a flag to force output even when there are no violations (/fo). This ensures a report artifact is generated without using a bunch of if statements in my CI&#8217;s NAnt file.</p>
<p>Another nice thing about FxCop that does not occur with CAT.NET is that it will fail the build automatically when it finds violations. When violations are found the return code from the command line utility is greater than 0 and NAnt will automatically fail the build unless you specify failonerror=&#8221;false&#8221;. Therefore, you don&#8217;t need a lot of extra build file code to check for errors with this utility.</p>
<p><strong>Common Errors &#8211; Assembly Not Strongly Named<br />
</strong></p>
<p>The first error I ran into was the strong naming error (rule Microsoft.Design#CA2210). Basically, Microsoft likes all of their assemblies to be <a title="Learn about strong naming in .NET" href="http://www.codeguru.com/columns/experts/article.php/c4643" target="_blank">strongly named</a> (cryptographically signed with a private key). To get around this, we need to sign our assemblies. Finding information on how to do this can be a little tricky, but the jist of it is:</p>
<ol>
<li>Open a Visual Studio 2005/2008 Command Prompt from the Start Menu (Start-&gt;Programs-&gt;Microsoft Visual Studio 2008-&gt;Visual Studio Tools-&gt;Visual Studio Command Prompt)</li>
<li>Change to your project directory (cd C:\Dev\Project1)</li>
<li>Run the command to generate a keyfile (sn.exe -k Project1.snk)
<ol>
<li>You can also seperate the public/private key in the case where your private key is only available to a small group of people and others use the public key by running: sn -p Project1.snk PublicProject1.snk</li>
</ol>
</li>
<li>Define a property in your project specifying the path to the keyfile (&lt;property name=&#8221;assembly.keyfile&#8221; value=&#8221;${root.dir}\Project1.snk&#8221; /&gt;)</li>
<li>On your csc tasks add the following attribute: keyfile=&#8221;${assembly.keyfile}&#8221;</li>
</ol>
<p>That&#8217;s it. Your assemblies will now be strongly named, and the violation will go away in FxCop. Obviously you may want to take this a step further and delay sign them and keep your private key available only in a secured location where deployment occurs.</p>
<p><strong>Common Errors &#8211; Assembly Information Missing</strong></p>
<p>The next error also deals with assembly attributes. When you define a new project in Visual Studio, it automatically adds an AssemblyInfo.cs file which contains things like the assembly title, description, copyright, keyfile, and more. there are a whole list of Assembly&lt;Something&gt;Attribute decorators you can use in your assembly. I have created a target that is called in all my compile targets right before I run csc that generates an AssemblyInfo.cs file for each project. The nice thing is that this lends itself to automating your versioning (another article) if you so choose. The target and an example of how I use it is below:</p>
<blockquote><p>&lt;target name=&#8221;GenerateAssemblyFile&#8221; description=&#8221;Generates an AssemblyInfo.cs File for inclusion in the compile methods&#8221;&gt;<br />
&lt;<a title="Read NAnt asminfo task documentation" href="http://nant.sourceforge.net/release/0.85/help/tasks/asminfo.html" target="_blank">asminfo</a> output=&#8221;${compile.dir}\AssemblyInfo.cs&#8221; language=&#8221;CSharp&#8221;&gt;<br />
&lt;imports&gt;<br />
&lt;import namespace=&#8221;System&#8221; /&gt;<br />
&lt;import namespace=&#8221;System.Reflection&#8221; /&gt;<br />
&lt;import namespace=&#8221;System.EnterpriseServices&#8221; /&gt;<br />
&lt;import namespace=&#8221;System.Runtime.InteropServices&#8221; /&gt;<br />
&lt;/imports&gt;<br />
&lt;attributes&gt;<br />
&lt;attribute type=&#8221;ComVisibleAttribute&#8221; value=&#8221;false&#8221; /&gt;<br />
&lt;attribute type=&#8221;CLSCompliantAttribute&#8221; value=&#8221;true&#8221; /&gt;<br />
&lt;attribute type=&#8221;AssemblyVersionAttribute&#8221; value=&#8221;${assembly.version}&#8221; /&gt;<br />
&lt;attribute type=&#8221;AssemblyTitleAttribute&#8221; value=&#8221;${assembly.title}&#8221; /&gt;<br />
&lt;attribute type=&#8221;AssemblyDescriptionAttribute&#8221; value=&#8221;${assembly.description}&#8221; /&gt;<br />
&lt;attribute type=&#8221;AssemblyCopyrightAttribute&#8221; value=&#8221;${assembly.copyright}&#8221; /&gt;<br />
&lt;attribute type=&#8221;ApplicationNameAttribute&#8221; value=&#8221;${assembly.name}&#8221; /&gt;<br />
&lt;/attributes&gt;<br />
&lt;references&gt;<br />
&lt;include name=&#8221;System.EnterpriseServices.dll&#8221; /&gt;<br />
&lt;/references&gt;<br />
&lt;/asminfo&gt;<br />
&lt;/target&gt;</p></blockquote>
<p>And the compile target that calls it:</p>
<blockquote><p>&lt;target name=&#8221;compile.models&#8221; depends=&#8221;init&#8221;&gt;<br />
&lt;property name=&#8221;compile.dir&#8221; value=&#8221;${project::get-name()}.Models&#8221; /&gt;<br />
&lt;property name=&#8221;assembly.title&#8221; value=&#8221;Models Library&#8221; /&gt;<br />
&lt;property name=&#8221;assembly.description&#8221; value=&#8221;Models Library for the MVC framework&#8221; /&gt;<br />
&lt;property name=&#8221;assembly.name&#8221; value=&#8221;${project::get-name()}.Models&#8221; /&gt;<br />
&lt;call target=&#8221;GenerateAssemblyFile&#8221; /&gt;</p>
<p>&lt;csc target=&#8221;library&#8221; output=&#8221;${build.dir}/${compile.dir}.dll&#8221; debug=&#8221;${debug.compile}&#8221; keyfile=&#8221;${assembly.keyfile}&#8221;&gt;<br />
&lt;sources&gt;<br />
&lt;include name=&#8221;${compile.dir}/**/*.cs&#8221; /&gt;<br />
&lt;/sources&gt;<br />
&lt;references&gt;<br />
&lt;include name=&#8221;${build.base.dir}/.Services.Proxy.dll&#8221; /&gt;<br />
&lt;/references&gt;<br />
&lt;/csc&gt;<br />
&lt;/target&gt;</p></blockquote>
<p>The target creates a bunch of properties to use in the GenerateAssemblyInfo target and then calls the genertion target. ${assembly.version} can be predefined, or you can use the NAntContrib &#8216;version&#8217; task to automate the version number information.</p>
<p><strong>Conclusion</strong></p>
<p>FxCop is a great tool to help your team stick to recognized framework coding standards that include design time, performance, and security issues. It still does not replace a human code review and it should only be used to augment your code review processes.</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/01/automating-code-review-tools-fxcop-part-iii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update to CAT.NET NAnt Target</title>
		<link>http://dataplex.org/blog/2009/01/update-to-catnet-nant-target/</link>
		<comments>http://dataplex.org/blog/2009/01/update-to-catnet-nant-target/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 16:29:09 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[CAT.NET]]></category>
		<category><![CDATA[code analysis]]></category>
		<category><![CDATA[NAnt]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=85</guid>
		<description><![CDATA[Yesterday I posted about automating CAT.NET. Today while adding it to another build file, I ran across a great error! The tool did not detect any vulnerabilities in my code and therefore the XPath used in the xmlpeek task failed! This caused the build to fail with a false positive. I&#8217;ve updated my target to [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://dataplex.org/blog/2009/01/update-to-catnet-nant-target/" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><div class="al2fb_send_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=170888536311777&amp;xfbml=1" type="text/javascript"></script>
<fb:send ref="AL2FB" font="arial" colorscheme="light" href="http://dataplex.org/blog/2009/01/update-to-catnet-nant-target/"></fb:send></div><p>Yesterday I posted about automating CAT.NET. Today while adding it to another build file, I ran across a great error! The tool did not detect any vulnerabilities in my code and therefore the XPath used in the xmlpeek task failed! This caused the build to fail with a false positive. I&#8217;ve updated my target to include the failonerror=&#8221;false&#8221; for the xmlpeek task and an if statement around the fail task that checks for the hasError property first. If it doesn&#8217;t exist the xmlpeek task did not find anything to put in the property and we do not need to fail the build.<span id="more-85"></span></p>
<p>Here is the new task:</p>
<blockquote><p>&lt;target name=&#8221;catnet&#8221; description=&#8221;Runs the CAT.NET static code analysis tool on a set of libraries&#8221;&gt;<br />
&lt;exec program=&#8221;${root.dir}\Microsoft\CAT.NET\CatNetCmd.exe&#8221; workingdir=&#8221;.&#8221; output=&#8221;catnetout.log&#8221;&gt;<br />
&lt;arg value=&#8221;/file:${build.dir}\${project::get-name()}.Models.dll&#8221; /&gt;<br />
&lt;arg value=&#8221;/file:${build.dir}\${project::get-name()}.Views.dll&#8221; /&gt;<br />
&lt;arg value=&#8221;/file:${build.dir}/${project::get-name()}.Presenters.dll&#8221; /&gt;<br />
&lt;arg value=&#8221;/file:${build.dir}/${project::get-name()}.Web.dll&#8221; /&gt;<br />
&lt;arg value=&#8221;/report:${reports.dir}\CatNetReport.xml&#8221; /&gt;<br />
&lt;arg value=&#8221;/reportxsloutput:${reports.dir}\CatNetReport.html&#8221; /&gt;<br />
&lt;/exec&gt;</p>
<p>&lt;!&#8211; Check for errors since the command doesn&#8217;t throw error codes &#8211;&gt;<br />
&lt;loadfile file=&#8221;catnetout.log&#8221; property=&#8221;catnetout&#8221; /&gt;<br />
&lt;fail if=&#8221;${string::contains(catnetout, &#8216;ERROR&#8217;)}&#8221; message=&#8221;There was an error running CAT.NET Static Analysis&#8221; /&gt;<br />
&lt;!&#8211; Clean up if we didn&#8217;t error out &#8211;&gt;<br />
&lt;delete file=&#8221;catnetout.log&#8221; /&gt;</p>
<p>&lt;xmlpeek file=&#8221;${reports.dir}\CatNetReport.xml&#8221;<br />
property=&#8221;hasErrors&#8221;<br />
xpath=&#8221;//Rule[TotalResults&gt;0]/Results/Result/ProblemDescription&#8221; failonerror=&#8221;false&#8221; /&gt;<br />
&lt;if test=&#8221;${property::exists(&#8216;hasErrors&#8217;)}&#8221;&gt;<br />
&lt;fail if=&#8221;${string::get-length(hasErrors) &amp;gt; 0}&#8221; message=&#8221;CAT.NET found at least one problem: ${hasErrors}&#8221; /&gt;<br />
&lt;/if&gt;<br />
&lt;/target&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/01/update-to-catnet-nant-target/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

