<?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>Rash thoughts about .NET, C#, F# and Dynamics NAV. &#187; Fake</title>
	<atom:link href="http://www.navision-blog.de/tag/fake/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.navision-blog.de</link>
	<description>This Blog is about Microsoft Dynamics NAV (f.k.a Navision incl. C/SIDE and C/AL), C#, F# and .NET in general.</description>
	<lastBuildDate>Wed, 14 Jul 2010 11:12:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>&quot;Fake &#8211; F# Make&quot; 1.40.5.0 released &#8211; Bugfixes for CruiseControl.NET</title>
		<link>http://www.navision-blog.de/2010/07/14/fake-f-make-1-40-5-0-released-bugfixes-for-cruisecontrol-net/</link>
		<comments>http://www.navision-blog.de/2010/07/14/fake-f-make-1-40-5-0-released-bugfixes-for-cruisecontrol-net/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 09:15:05 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[docu]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2010/07/14/fake-f-make-1-40-5-0-released-bugfixes-for-cruisecontrol-net/</guid>
		<description><![CDATA[Today I released “FAKE – F# Make” version 1.40.5.0. This release fixes some issues with CruiseControl.NET compatibility and improves the MSBuild task. Important links: Project page Download HTML Documentation Repository Changes for CruiseControl.NET Daniel Nauck created a FAKE task for CC.Net. This task allows a much easier configuration of FAKE. Please download the latest CC.NET [...]]]></description>
			<content:encoded><![CDATA[<p>Today I released “FAKE – F# Make” version 1.40.5.0. This release fixes some issues with <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">CruiseControl.NET</a> compatibility and improves the MSBuild task.</p>
<p>Important links:</p>
<ul>
<li><a href="http://bitbucket.org/forki/fake/wiki/Home">Project page</a></li>
<li><a href="http://bitbucket.org/forki/fake/downloads">Download</a></li>
<li><a href="http://www.navision-blog.de/fake/">HTML Documentation</a></li>
<li><a href="http://github.com/forki/FAKE">Repository</a></li>
<li><script src="http://www.ohloh.net/p/483999/widgets/project_thin_badge.js" type="text/javascript"></script></li>
</ul>
<h5>Changes for CruiseControl.NET</h5>
<p><a href="http://twitter.com/dnauck">Daniel Nauck</a> created a <a href="http://confluence.public.thoughtworks.org/display/CCNET/FAKE+Task">FAKE task for CC.Net</a>. This task allows a much easier configuration of FAKE. Please download the <a href="http://ccnetlive.thoughtworks.com/CCNet-builds/1.6.0/">latest CC.NET build</a> if you want to use it.</p>
<p>Daniel also created a <a href="http://build.nauck-it.de/server/build.nauck-it.de/ViewServerReport.aspx?Category=FAKE">FAKE build project on his server</a> which showed us some compatibility issues:</p>
<ul>
<li>In FAKE:
<ul>
<li>Race condition in FAKE’s trace functionality</li>
<li>Better XML tracing if something fails</li>
<li>The tracing buffer will be flushed after every build target</li>
<li>Every task has a Timeout property (Default: 5 min.)</li>
<li>Setting of environment variables fixed</li>
<li><a href="http://www.nunit.org/index.php?p=consoleCommandLine&amp;r=2.2">Showing labels in NUnit</a> is now the default</li>
</ul>
</li>
<li>In <a href="http://docu.jagregory.com/">Docu</a>:
<ul>
<li><a href="http://github.com/forki/docu/commit/80daa6b48cb7f652ff5646a45fce4b94619fad1f">Unhandled exception in Docu.exe</a></li>
</ul>
</li>
<li>In CC.NET:
<ul>
<li>Implemented <a href="http://confluence.public.thoughtworks.org/display/CCNET/Git+Source+Control+Block">support for git submodules</a> (<a href="http://jira.public.thoughtworks.org/browse/CCNET-1922">CCNET-1922</a>)</li>
</ul>
</li>
</ul>
<p>@Daniel: Thank you very much for helping me on this CruiseControl.NET stuff. I really appreciate this.</p>
<h5>MSBuild task changes</h5>
<p>The MSBuild task in FAKE gets a sequence of project files and compiles them in the given order. This might be slow if you have lots of dependent projects. Then MSBuild might analyze the dependencies over and over again. To fix this issue I currently see two possible solutions:</p>
<ol>
<li>Generate a temporary solution file and use this for compilation.</li>
<li>Analyze the given projects and remove all dependent projects from the list.</li>
</ol>
<p>FAKE 1.40.5.0 implements the second idea. If you have a better idea please contact me.</p>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2010/07/14/fake-f-make-1-40-5-0-released-bugfixes-for-cruisecontrol-net/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>&#8220;Fake &#8211; F# Make&#8221; 1.33.0 released</title>
		<link>http://www.navision-blog.de/2010/07/11/fake-f-make-1-33-0-released/</link>
		<comments>http://www.navision-blog.de/2010/07/11/fake-f-make-1-33-0-released/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 15:11:49 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[SideBySideSpecification]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[XPath]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2010/07/11/fake-f-make-1-33-0-released/</guid>
		<description><![CDATA[Yesterday I released “FAKE – F# Make” version 1.33.0. This release has lots of small bug fixes and a couple of new features. Important links: Project page Download Repository Git helpers -Fake.Git.dll Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I released “FAKE – F# Make” version 1.33.0. This release has lots of small bug fixes and a couple of new features.</p>
<p>Important links:</p>
<ul>
<li><a href="http://bitbucket.org/forki/fake/wiki/Home">Project page</a></li>
<li><a href="http://bitbucket.org/forki/fake/downloads">Download</a></li>
<li><a href="http://github.com/forki/FAKE">Repository</a></li>
</ul>
<h5>Git helpers -Fake.Git.dll</h5>
<blockquote><p>Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.</p>
<p>[<a href="http://en.wikipedia.org/wiki/Git_%28software%29">Wikipedia</a>]</p></blockquote>
<p>In the last couple of months I worked on small helper library for controlling <a href="http://en.wikipedia.org/wiki/Git_%28software%29">Git</a>. This library is now released as part of “FAKE – F# Make”. You can find the source code at <a title="http://github.com/forki/FAKE/tree/master/src/app/Fake.Git/" href="http://github.com/forki/FAKE/tree/master/src/app/Fake.Git/">http://github.com/forki/FAKE/tree/master/src/app/Fake.Git/</a>.</p>
<p>Features:</p>
<ul>
<li>Repository handling
<ul>
<li>init, clone</li>
</ul>
</li>
<li>Submodules
<ul>
<li>init, clone, information about submodules</li>
</ul>
</li>
<li>Branches
<ul>
<li>checkout, create, delete, merge, rebase, tag, pull, push, reset, commit, …</li>
</ul>
</li>
<li>SHA1 calculation</li>
</ul>
<h5>Documentation generation with James Gregory&#8217;s docu tool</h5>
<blockquote><p><strong>What&#8217;s a docu?</strong> A documentation generator for .Net that isn&#8217;t complicated, awkward, or difficult to use. Given an assembly and the XML that&#8217;s generated by Visual Studio, docu can produce an entire website of documentation with a single command.</p>
<p>[<a href="http://docu.jagregory.com/">docu website</a>]</p></blockquote>
<p>Fake comes bundled with James Gregory’s documentations generator “<a href="http://docu.jagregory.com/">docu</a>”, which converts <a href="http://msdn.microsoft.com/en-us/library/b2s063f7%28VS.71%29.aspx">XML-Documentation</a> comments into HTML files. All you need to do is downloading a <a href="http://bitbucket.org/forki/fake/downloads/templates.zip">template</a> and calling the docu task inside your build script:</p>
<pre style="font-family: consolas;">!+ (buildDir + <span style="color: maroon;">"*.dll"</span>)
     |&gt; Scan
     |&gt; Docu (<span style="color: blue;">fun</span> p <span style="color: blue;">-&gt;
</span>         {p <span style="color: blue;">with
</span>             ToolPath = docuPath + <span style="color: maroon;">"docu.exe"</span>
             TemplatesPath = templatesSrcDir
             OutputPath = docsDir })</pre>
<p>Since FAKE builds its own documentation with docu I started to add more (and hopefully better) XML doc comments. My plan is to describe more and more of the internal FAKE functions in the next releases. An updated HTML-document (generated via a <a href="http://docu.jagregory.com/">docu</a> task) can be found at <a title="http://www.navision-blog.de/fake/" href="http://www.navision-blog.de/fake/">http://www.navision-blog.de/fake/</a>.</p>
<h5>Side by side specification</h5>
<p>For Test-driven development (TDD) it’s sometimes nice to have the specifications next to the implementation files since the specs are considered as documentation.</p>
<p>By using a tool like <a title="VsCommands" href="http://mokosh.co.uk/vscommands/">VSCommands</a> it is possible to group the implementation with the specs (see also <a href="http://gist.github.com/457248">http://gist.github.com/457248</a>).</p>
<p>This “side by side specification” makes TDD a lot easier but of course  we don&#8217;t want to deploy the specification classes and the test data.</p>
<table>
<tbody>
<tr>
<td><img style="display: inline; border-width: 0px;" title="Side by side specification" src="http://www.navision-blog.de/images/FakeFMake1.33.0released_B55F/image.png" border="0" alt="Side by side specification" width="221" height="201" /></td>
<td>==&gt;</td>
<td><img style="display: inline; border-width: 0px;" title="After &quot;RemoveTestFromProject&quot;" src="http://www.navision-blog.de/images/FakeFMake1.33.0released_B55F/image_3.png" border="0" alt="After &quot;RemoveTestFromProject&quot;" width="142" height="117" /></td>
</tr>
</tbody>
</table>
<p>FAKE has a new feature which automatically removes all specification files and test framework references according to a given convention:</p>
<pre style="font-family: consolas;">Target <span style="color: maroon;">"BuildApp"</span> (<span style="color: blue;">fun</span> _ –<span style="color: blue;">&gt;
</span>      !+ <span style="color: maroon;">@"src\app\**\*.csproj"</span>
         |&gt; Scan
         |&gt; <strong>Seq.map (
             RemoveTestsFromProject
                 AllNUnitReferences      <span style="color: green;">// a default references convention</span>
                 AllSpecAndTestDataFiles <span style="color: green;">// a default file convention
</span>                 )</strong>
         |&gt; MSBuildRelease buildDir <span style="color: maroon;">"Build"</span>
         |&gt; Log <span style="color: maroon;">"AppBuild-Output: "</span>
)</pre>
<p>The conventions are simple functions and can be customized e.g.:</p>
<pre style="font-family: consolas;"><span style="color: green;">/// All Spec.cs or Spec.fs files and all files containing TestData</span>
<span style="color: blue;">let</span> AllSpecAndTestDataFiles elementName (s:string) =
     s.EndsWith <span style="color: maroon;">"Specs.cs"</span> ||
       s.EndsWith <span style="color: maroon;">"Specs.fs"</span> ||
       (elementName = <span style="color: maroon;">"Content"</span> &amp;&amp; s.Contains <span style="color: maroon;">"TestData"</span>)</pre>
<h5>Miscellaneous</h5>
<ul>
<li>SQL Server helpers are moved to Fake.SQL.dll
<ul>
<li>Additional functions for attaching and detaching databases.</li>
</ul>
</li>
<li>FileHelper.CopyCached function was added
<ul>
<li>Copies the files from a cache folder. If the files are not cached or the original files have a different write time the cache will be refreshed.</li>
</ul>
</li>
<li>EnvironmentHelper.environVarOrDefault added
<ul>
<li>Retrieves the environment variable or a given default.</li>
</ul>
</li>
<li>Fixed <a href="http://github.com/forki/FAKE/issues/closed#issue/3">Issue 3</a>: toRelativePath calculates paths with ..\..\ if needed</li>
<li>Added a build time report to the build output.</li>
<li>XPathReplace and XMLPoke tasks added.
<ul>
<li>Replaces text in an XML file at the location specified by an XPath expression.</li>
</ul>
</li>
<li><a href="http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx">ILMerge</a> task added</li>
<li><a href="http://wix.sourceforge.net/">Windows Installer XML (WiX)</a> task added</li>
</ul>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2010/07/11/fake-f-make-1-33-0-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using a MailboxProcessor to speedup &#8220;FAKE &#8211; F# MAKE&#8221;</title>
		<link>http://www.navision-blog.de/2010/05/07/using-a-mailboxprocessor-to-speedup-fake-f-make/</link>
		<comments>http://www.navision-blog.de/2010/05/07/using-a-mailboxprocessor-to-speedup-fake-f-make/#comments</comments>
		<pubDate>Fri, 07 May 2010 11:37:28 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2010/05/07/using-a-mailboxprocessor-to-speedup-fake-f-make/</guid>
		<description><![CDATA[Earlier today I released “FAKE – F# Make” version 1.10.0. This new release contains a lot path issue fixes for Mono and a new architecture for logging and tracing. A guy named Joel Mueller had an awesome idea and sent me some patches. He noticed that TraceHelper.fs writes all messages synchronously to the console and/or [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today I released <a href="http://bitbucket.org/forki/fake/downloads">“FAKE – F# Make” version 1.10.0</a>. This new release contains a lot path issue fixes for <a href="http://www.mono-project.com/Main_Page">Mono</a> and a new architecture for logging and tracing. </p>
<p>A guy named Joel Mueller had an awesome idea and sent me some patches. He noticed that TraceHelper.fs writes all messages synchronously to the console and/or a XML output file, which means the actual build operations must wait on the writing of hundreds of trace messages, slowing down the actual build.</p>
<p>His idea was to use a MailboxProcessor to buffer up the trace messages and write them out asynchronously, so that the actual build can proceed at full speed.</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><span style="color: blue">type</span> Message = </p>
<p style="margin: 0px">&#160;&#160;&#160; { Text&#160;&#160;&#160;&#160;&#160; : string</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160; Color&#160;&#160;&#160;&#160; : ConsoleColor</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160; Newline&#160;&#160; : bool</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160; Important : bool}</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px"><span style="color: green">/// &#8230;.</span></p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px"><span style="color: blue">let</span> buffer = MailboxProcessor.Start (<span style="color: blue">fun</span> inbox <span style="color: blue">-&gt;</span></p>
<p style="margin: 0px">&#160;&#160;&#160; <span style="color: blue">let</span> <span style="color: blue">rec</span> loop () = </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160; async {</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">let!</span> (msg:Message) = inbox.Receive()</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">match</span> traceMode <span style="color: blue">with</span></p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Console <span style="color: blue">-&gt;</span> logMessageToConsole msg</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Xml&#160;&#160;&#160;&#160; <span style="color: blue">-&gt;</span> appendXML msg.Text</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">return!</span> loop ()}</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">&#160;&#160;&#160; loop ())&#160;&#160;&#160;&#160;&#160; </p>
</p></div>
<p>Now all internal logging and tracing functions can post their their messages to the inbox of the MailboxProcessor:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><span style="color: green">/// Logs the specified string (via message buffer)</span></p>
<p style="margin: 0px"><span style="color: blue">let</span> logMessage important newLine message =</p>
<p style="margin: 0px">&#160;&#160;&#160; <span style="color: blue">match</span> traceMode <span style="color: blue">with</span></p>
<p style="margin: 0px">&#160;&#160;&#160; | Console <span style="color: blue">-&gt;</span></p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160; { Text = message; </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Important = important; </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Newline = newLine; </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Color = ConsoleColor.White }</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&gt; buffer.Post</p>
<p style="margin: 0px">&#160;&#160;&#160; | Xml&#160;&#160;&#160;&#160; <span style="color: blue">-&gt;</span> </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160; { defaultMessage <span style="color: blue">with</span> </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Text = sprintf <span style="color: maroon">&quot;&lt;message&gt;&lt;![CDATA[%s]]&gt;&lt;/message&gt;&quot;</span> </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; message }</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&gt; buffer.Post </p>
</p></div>
<p>This idea reduces the build time of FAKE’s self build from 3 min. to 2 min. Which is really amazing, since I didn’t have to change anything in the build script. This version is compatible to the last released version.</p>
<p>Please download <a href="http://bitbucket.org/forki/fake/downloads">“FAKE – F# Make” version 1.10.0</a> and tell me what you think.</p>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2010/05/07/using-a-mailboxprocessor-to-speedup-fake-f-make/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New syntactic sugar for &#8220;FAKE &#8211; F# Make&#8221; &#8211; Getting rid of magic strings</title>
		<link>http://www.navision-blog.de/2010/02/08/new-syntactic-sugar-for-fake-f-make-getting-rid-of-magic-strings/</link>
		<comments>http://www.navision-blog.de/2010/02/08/new-syntactic-sugar-for-fake-f-make-getting-rid-of-magic-strings/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 17:58:12 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[English posts]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2010/02/08/new-syntactic-sugar-for-fake-f-make-getting-rid-of-magic-strings/</guid>
		<description><![CDATA[The new version 0.27 of “FAKE – F# Make” comes with new syntactic sugar for build targets and build dependencies. Don’t be afraid the old version is still supported &#8211; all scripts should still work with the new version. The problem Consider the following target definition: let buildDir = &#34;./build/&#34; &#160; Target &#34;Clean&#34; (fun _ [...]]]></description>
			<content:encoded><![CDATA[<p>The new version 0.27 of “FAKE – F# Make” comes with new syntactic sugar for build targets and build dependencies. Don’t be afraid the old version is still supported &#8211; all scripts should still work with the new version.</p>
<h5>The problem</h5>
<p>Consider the following target definition:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><span style="color: blue">let</span> buildDir = <span style="color: maroon">&quot;./build/&quot;</span></p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">Target <span style="color: maroon">&quot;Clean&quot;</span> (<span style="color: blue">fun</span> _ <span style="color: blue">-&gt;</span></p>
<p style="margin: 0px">&#160; CleanDir buildDir</p>
<p style="margin: 0px">)</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">Target <span style="color: maroon">&quot;Default&quot;</span> (<span style="color: blue">fun</span> _ <span style="color: blue">-&gt;</span></p>
<p style="margin: 0px">&#160; trace <span style="color: maroon">&quot;Hello World from FAKE&quot;</span></p>
<p style="margin: 0px">)</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px"><span style="color: maroon">&quot;Default&quot;</span> &lt;== [<span style="color: maroon">&quot;Clean&quot;</span>]</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">run <span style="color: maroon">&quot;Default&quot;</span></p>
</p></div>
<p>As you can see we are having a lot of “magic strings” for the target names and the dependency definitions. This was always a small shortcoming in FAKE, since this doesn’t allow refactoring and may result in runtime errors. </p>
<p>One of my goals for “FAKE – F# Make” is to remove these strings in future versions. Unfortunately this is not that easy, because it causes a lot of internal issues. In particular logging to the build server is much harder if you don’t have a target name.</p>
<h5></h5>
<h5>The first step</h5>
<p>As posted in a <a href="http://bitbucket.org/forki/fake/issue/5/mono-support-is-not-working">bitbucket</a> comment by <a href="http://bitbucket.org/cipher/">cipher</a> we could use the “<a href="http://weblogs.asp.net/podwysocki/archive/2010/02/05/using-and-abusing-the-f-dynamic-lookup-operator.aspx">dynamic lookup operator</a>” to remove some of the magic strings without breaking any internal code.</p>
<p>As a result we can rewrite the above sample as:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><span style="color: blue">let</span> buildDir = <span style="color: maroon">&quot;./build/&quot;</span></p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">Target? Clean &lt;-</p>
<p style="margin: 0px">&#160;&#160;&#160; <span style="color: blue">fun</span> _ <span style="color: blue">-&gt;</span> CleanDir buildDir</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">Target? Default &lt;-</p>
<p style="margin: 0px">&#160;&#160;&#160; <span style="color: blue">fun</span> _ <span style="color: blue">-&gt;</span> trace <span style="color: maroon">&quot;Hello World from FAKE&quot;</span></p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">For? Default &lt;- Dependency? Clean</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">Run? Default</p>
</p></div>
<p>All magic strings suddenly disappeared. I think this syntax looks really nice, but unfortunately the strings are not really gone, since the token <strong>Default</strong> is only checked at runtime.</p>
<h5>The idea for future versions</h5>
<p>Since the new syntax is really just syntactic sugar I’m always interested in a better solution. Currently I’m working on a syntax using monads. The result could look like this:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><span style="color: blue">let</span> buildDir = <span style="color: maroon">&quot;./build/&quot;</span></p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px"><span style="color: blue">let</span> Clean = target { CleanDir buildDir }</p>
<p style="margin: 0px"><span style="color: blue">let</span> Default = </p>
<p style="margin: 0px">&#160; target { </p>
<p style="margin: 0px">&#160;&#160;&#160; trace <span style="color: maroon">&quot;Hello World from FAKE&quot;</span> </p>
<p style="margin: 0px">&#160;&#160;&#160; trace <span style="color: maroon">&quot;Another line&quot;</span></p>
<p style="margin: 0px">&#160; }</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">Default &lt;== [Clean]</p>
<p style="margin: 0px"><span style="color: green"></span></p>
</p></div>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px">Run Default</p>
</p></div>
<p>This way the magic string are really gone, but my current problem is retrieving the target name from the let-binding name. Please leave a comment if you have an idea to solve this issue.</p>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2010/02/08/new-syntactic-sugar-for-fake-f-make-getting-rid-of-magic-strings/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>xUnit.net support in &#8220;FAKE &#8211; F# Make&#8221; 0.14</title>
		<link>http://www.navision-blog.de/2009/10/18/xunit-support-in-fake-f-make-0-14/</link>
		<comments>http://www.navision-blog.de/2009/10/18/xunit-support-in-fake-f-make-0-14/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 16:09:16 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[CruiseControl.NET]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>
		<category><![CDATA[nunit]]></category>
		<category><![CDATA[xUnit.net. TeamCity]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2009/10/18/xunit-support-in-fake-f-make-0-14/</guid>
		<description><![CDATA[Yesterday I released “FAKE – F# Make” version 0.14 with xUnit.net support. The usage is very easy and similar to the usage of NUnit: Target &#34;xUnitTest&#34; (fun () -&#62;&#160; &#160; let testAssemblies = &#160;&#160;&#160; !+ (testDir + @&#34;\Test.*.dll&#34;) &#160;&#160;&#160;&#160;&#160; &#124;&#62; Scan &#160; &#160; xUnit &#160;&#160;&#160; (fun p -&#62; &#160;&#160;&#160;&#160;&#160;&#160; {p with &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ShadowCopy = false; [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I released <a href="http://code.google.com/p/fake/">“FAKE – F# Make”</a> version 0.14 with <a href="http://www.codeplex.com/xunit">xUnit.net</a> support. The usage is very easy and similar to the usage of NUnit: </p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px">Target <span style="color: maroon">&quot;xUnitTest&quot;</span> (<span style="color: blue">fun</span> () <span style="color: blue">-&gt;</span>&#160; </p>
<p style="margin: 0px">&#160; <span style="color: blue">let</span> testAssemblies = </p>
<p style="margin: 0px">&#160;&#160;&#160; !+ (testDir + <span style="color: maroon">@&quot;\Test.*.dll&quot;</span>) </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160; |&gt; Scan</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">&#160; xUnit </p>
<p style="margin: 0px">&#160;&#160;&#160; (<span style="color: blue">fun</span> p <span style="color: blue">-&gt;</span> </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160; {p <span style="color: blue">with</span> </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ShadowCopy = <span style="color: blue">false</span>;</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HtmlPrefix = testDir}) </p>
<p style="margin: 0px">&#160;&#160;&#160; testAssemblies&#160; </p>
<p style="margin: 0px">)</p>
</p></div>
<p>This sample works perfectly with <a href="http://www.jetbrains.com/teamcity/">TeamCity</a> and creates a html-page per test project in addition:</p>
<p><img class="bordered" title="TeamCity output" alt="TeamCity output" src="http://www.navision-blog.de/images/xUnitsupportinFAKEFMake0.14_FF4A/image.png" width="500" height="279" /></p>
<p><img class="bordered" title="HMTL output" alt="HMTL output" src="http://www.navision-blog.de/images/xUnitsupportinFAKEFMake0.14_FF4A/image_3.png" width="500" height="135" /></p>
<p>If you want to publish the xUnit.net test results in <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">CruiseControl.NET</a> just modify the build script a little:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px">Target <span style="color: maroon">&quot;xUnitTest&quot;</span> (<span style="color: blue">fun</span> () <span style="color: blue">-&gt;</span>&#160; </p>
<p style="margin: 0px">&#160; <span style="color: blue">let</span> testAssemblies = </p>
<p style="margin: 0px">&#160;&#160;&#160; !+ (testDir + <span style="color: maroon">@&quot;\Test.*.dll&quot;</span>) </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160; |&gt; Scan</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">&#160; xUnit </p>
<p style="margin: 0px">&#160;&#160;&#160; (<span style="color: blue">fun</span> p <span style="color: blue">-&gt;</span> </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160; {p <span style="color: blue">with</span> </p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ShadowCopy = <span style="color: blue">false</span>;</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HtmlPrefix = testDir;</p>
<p style="margin: 0px">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>XmlPrefix = testDir</strong> }) </p>
<p style="margin: 0px">&#160;&#160;&#160; testAssemblies&#160; </p>
<p style="margin: 0px">)</p>
</p></div>
<p>Now follow the steps in the <a href="http://xunit.codeplex.com/wikipage?title=HowToUseCcNet&amp;ProjectName=xunit">CrusieControl.NET documentation</a>. You will need to download the <a href="http://xunit.codeplex.com/">xUnitSummary.xsl</a> file and save it to your webdashboard directory. If everything works correctly you should see something like this:</p>
<p><img class="bordered" title="CruisControl.NET output" alt="CruisControl.NET output" src="http://www.navision-blog.de/images/xUnitsupportinFAKEFMake0.14_FF4A/image_4.png" width="500" height="300" /></p>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2009/10/18/xunit-support-in-fake-f-make-0-14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating a &#8220;FAKE &#8211; F# Make&#8221; build script into CruiseControl.NET</title>
		<link>http://www.navision-blog.de/2009/10/14/integrating-a-fake-f-make-build-script-into-cruisecontrol-net/</link>
		<comments>http://www.navision-blog.de/2009/10/14/integrating-a-fake-f-make-build-script-into-cruisecontrol-net/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 08:38:55 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[CC.NET]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[CruiseControl]]></category>
		<category><![CDATA[CruiseControl.NET]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2009/10/14/integrating-a-fake-f-make-build-script-into-cruisecontrol-net/</guid>
		<description><![CDATA[Since version 0.12 the FAKE build system provides an easy way to setup build configurations for CruiseControl.NET. “CruiseControl.NET is an Automated Continuous Integration server, implemented using the Microsoft .NET Framework.” [thoughtworks.org] In this article I will show you how you can set up a FAKE build script in CruiseControl.NET. We will use the CalculatorSample which [...]]]></description>
			<content:encoded><![CDATA[<p>Since version 0.12 the <a href="http://code.google.com/p/fake/">FAKE build system</a> provides an easy way to setup build configurations for <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">CruiseControl.NET</a>.</p>
<blockquote><p><strong>“CruiseControl.NET</strong> is an Automated Continuous Integration server, implemented using the Microsoft .NET Framework.”</p>
<p align="right">[<a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">thoughtworks.org</a>] </p>
</blockquote>
<p>In this article I will show you how you can set up a FAKE build script in CruiseControl.NET. We will use the CalculatorSample which you can download from the <a href="http://code.google.com/p/fake/downloads/list">FAKE Download page</a>.</p>
<p>If you want to know how this build script works and how you could create one for your own projects please read the <a href="http://www.navision-blog.de/2009/04/01/getting-started-with-fake-a-f-sharp-make-tool/">“Getting started with FAKE”-tutorial</a>.</p>
<p>If you want to set up “FAKE – F# Make” build configurations in TeamCity please read <a href="http://www.navision-blog.de/2009/04/15/integrate-a-fake-f-make-build-script-into-teamcity/">“Integrating a &quot;FAKE – F# Make&quot; build script into TeamCity</a>”.</p>
<h5>Installing CruiseControl.NET</h5>
<p>You can download CruiseControl.NET from <a href="http://confluence.public.thoughtworks.org/display/CCNET/Download">thoughtworks.org</a>. After the installation process (<a href="http://confluence.public.thoughtworks.org/display/CCNET/Basic+Installation">further instructions</a>) you should see an empty dashboard:</p>
<p><a href="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image.png"><img class="bordered" title="CruiseControl.NET Dashboard" border="0" alt="CruiseControl.NET Dashboard" src="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_thumb.png" width="500" height="231" /></a> </p>
<h5>Installing Subversion</h5>
<p>The CalculatorSample is using Subversion (SVN) for <a href="http://en.wikipedia.org/wiki/Revision_control">SourceControl</a>, so we need to download SVN from <a title="http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100" href="http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100">subversion.tigris.org</a>. I’m using the “Windows MSI installer with the basic win32 binaries” and installed them under “c:\Program Files (x86)\Subversion\”.</p>
<h5>Installing FxCop</h5>
<p>The CalculatorSample is using <a href="http://msdn.microsoft.com/en-us/library/bb429476%28VS.80%29.aspx">FxCop</a>, so we need to <a href="http://www.microsoft.com/downloads/details.aspx?familyid=9AEAA970-F281-4FB0-ABA1-D59D7ED09772&amp;displaylang=en">download</a> and install it next.</p>
<blockquote><p>“FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework common language runtime) and reports information about the assemblies, such as possible design, localization, performance, and security improvements. Many of the issues concern violations of the programming and design rules set forth in the <a href="http://go.microsoft.com/fwlink/?LinkId=70287">Design Guidelines</a> for Class Library Developers, which are the Microsoft guidelines for writing robust and easily maintainable code by using the .NET Framework.”</p>
<p align="right">[<a href="http://msdn.microsoft.com/en-us/library/bb429476%28VS.80%29.aspx">MSDN</a>]</p>
</blockquote>
<h5>Creating a FAKE Project</h5>
<p>Now create a new folder for the CalculatorSample sources. I’m using “<strong>d:\Calculator\</strong>” for the rest of the article.</p>
<p>The next step is to modify the CruiseControl.NET config file (“c:\Program Files (x86)\CruiseControl.NET\server\ccnet.config” on my machine):</p>
<div style="font-family: courier new; background: white; color: black; font-size: 7pt">
<p style="margin: 0px"><span style="color: blue">&lt;</span><span style="color: #a31515">cruisecontrol</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;</span><span style="color: #a31515">project</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">name</span><span style="color: blue">&gt;</span>CalculatorExample<span style="color: blue">&lt;/</span><span style="color: #a31515">name</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">triggers</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">intervalTrigger</span><span style="color: blue"> </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">continuous</span>&quot;<span style="color: blue"> </span><span style="color: red">seconds</span><span style="color: blue">=</span>&quot;<span style="color: blue">30</span>&quot;<span style="color: blue"> </span><span style="color: red">initialSeconds</span><span style="color: blue">=</span>&quot;<span style="color: blue">30</span>&quot;<span style="color: blue">/&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">triggers</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">sourcecontrol</span><span style="color: blue"> </span><span style="color: red">type</span><span style="color: blue">=</span>&quot;<span style="color: blue">svn</span>&quot;<span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">executable</span><span style="color: blue">&gt;</span>c:\Program Files (x86)\Subversion\bin\svn.exe<span style="color: blue">&lt;/</span><span style="color: #a31515">executable</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">workingDirectory</span><span style="color: blue">&gt;</span>d:\Calculator\<span style="color: blue">&lt;/</span><span style="color: #a31515">workingDirectory</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">trunkUrl</span><span style="color: blue">&gt;</span>http://fake.googlecode.com/svn/trunk/Samples/Calculator/<span style="color: blue">&lt;/</span><span style="color: #a31515">trunkUrl</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">sourcecontrol</span><span style="color: blue">&gt;&#160;&#160;&#160; </span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">tasks</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">exec</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">executable</span><span style="color: blue">&gt;</span>d:\Calculator\tools\Fake\Fake.exe<span style="color: blue">&lt;/</span><span style="color: #a31515">executable</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">baseDirectory</span><span style="color: blue">&gt;</span>d:\Calculator\<span style="color: blue">&lt;/</span><span style="color: #a31515">baseDirectory</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">buildArgs</span><span style="color: blue">&gt;</span>completeBuild.fsx<span style="color: blue">&lt;/</span><span style="color: #a31515">buildArgs</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">exec</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">tasks</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">publishers</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">merge</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">files</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">file</span><span style="color: blue">&gt;</span>d:\Calculator\test\FXCopResults.xml<span style="color: blue">&lt;/</span><span style="color: #a31515">file</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">file</span><span style="color: blue">&gt;</span>d:\Calculator\test\TestResults.xml<span style="color: blue">&lt;/</span><span style="color: #a31515">file</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">file</span><span style="color: blue">&gt;</span>d:\Calculator\output\Results.xml<span style="color: blue">&lt;/</span><span style="color: #a31515">file</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">files</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">merge</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">xmllogger</span><span style="color: blue"> /&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">publishers</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;/</span><span style="color: #a31515">project</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&lt;/</span><span style="color: #a31515">cruisecontrol</span><span style="color: blue">&gt;</span></p>
</p></div>
<p>In this configuration I set up a trigger which checks every 30 sec. for changes in my CalculatorSample project. </p>
<p>If SVN finds changes FAKE.exe is called with my build script (completeBuild.fsx). </p>
<p>After the build I want to merge the FxCop and NUnit output files with my build results to create a build report.</p>
<h5>Configuring the dashboard</h5>
<p>In order to provide a nicer output on the dashboard we need to modify the BuildPlugins section in the dashboard.config file (“c:\Program Files (x86)\CruiseControl.NET\webdashboard\dashboard.config” on my machine):</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><span style="color: blue">&lt;</span><span style="color: #a31515">buildPlugins</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;</span><span style="color: #a31515">buildReportBuildPlugin</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">xslFileNames</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span>xsl\header.xsl<span style="color: blue">&lt;/</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span>xsl\modifications.xsl<span style="color: blue">&lt;/</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span>xsl\NCoverSummary.xsl<span style="color: blue">&lt;/</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span>xsl\fxcop-summary_1_36.xsl<span style="color: blue">&lt;/</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span>xsl\unittests.xsl<span style="color: blue">&lt;/</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span>xsl\nant.xsl<span style="color: blue">&lt;/</span><span style="color: #a31515">xslFile</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">xslFileNames</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;/</span><span style="color: #a31515">buildReportBuildPlugin</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;</span><span style="color: #a31515">buildLogBuildPlugin</span><span style="color: blue"> /&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;</span><span style="color: #a31515">xslReportBuildPlugin</span><span style="color: blue"> </span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160; </span><span style="color: red">description</span><span style="color: blue">=</span>&quot;<span style="color: blue">NCover Report</span>&quot;<span style="color: blue"> </span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160; </span><span style="color: red">actionName</span><span style="color: blue">=</span>&quot;<span style="color: blue">NCoverBuildReport</span>&quot;<span style="color: blue"> </span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160; </span><span style="color: red">xslFileName</span><span style="color: blue">=</span>&quot;<span style="color: blue">xsl\NCover.xsl</span>&quot;<span style="color: blue">&gt;&lt;/</span><span style="color: #a31515">xslReportBuildPlugin</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;</span><span style="color: #a31515">xslReportBuildPlugin</span><span style="color: blue"> </span><span style="color: red">description</span><span style="color: blue">=</span>&quot;<span style="color: blue">FxCop Report</span>&quot;</p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160; </span><span style="color: red">actionName</span><span style="color: blue">=</span>&quot;<span style="color: blue">FxCopBuildReport</span>&quot;</p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160; </span><span style="color: red">xslFileName</span><span style="color: blue">=</span>&quot;<span style="color: blue">xsl\fxcop-report_1_36.xsl</span>&quot;<span style="color: blue"> /&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;</span><span style="color: #a31515">xslReportBuildPlugin</span><span style="color: blue"> </span><span style="color: red">description</span><span style="color: blue">=</span>&quot;<span style="color: blue">NUnit Report</span>&quot;</p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160; </span><span style="color: red">actionName</span><span style="color: blue">=</span>&quot;<span style="color: blue">NUnitBuildReport</span>&quot;</p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160;&#160; </span><span style="color: red">xslFileName</span><span style="color: blue">=</span>&quot;<span style="color: blue">xsl\tests.xsl</span>&quot;<span style="color: blue"> /&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&lt;/</span><span style="color: #a31515">buildPlugins</span><span style="color: blue">&gt;</span></p>
</p></div>
<p>As you can see we use the nant.xsl to transform the FAKE output to HTML.</p>
<h5>Starting the build</h5>
<p>Now if everything is configured correctly, you can tell CruiseControl.NET to run your build (press “Start” for your build project on the dashboard):</p>
<p><img class="bordered" title="Press Start on the dashboard" alt="Press Start on the dashboard" src="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_3.png" width="500" height="106" /> </p>
<p>Now CruiseControl.NET should use SVN to checkout the CalculatorSample sources and run the build. The output on the project page for build 1 should look like this:</p>
<p><a href="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_4.png"><img class="bordered" title="Build output" alt="Build output" src="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_thumb_3.png" width="500" height="388" /></a> </p>
<p><a href="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_5.png"><img class="bordered" title="Build output 2" border="0" alt="Build output 2" src="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_thumb_4.png" width="500" height="388" /></a> </p>
<p>You can also inspect the NUnit and FxCop results:</p>
<p>&#160;<a href="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_6.png"><img class="bordered" title="NUnit zest results" border="0" alt="NUnit zest results" src="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_thumb_5.png" width="500" height="236" /></a> </p>
<p><a href="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_7.png"><img class="bordered" title="FxCop results" border="0" alt="FxCop results" src="http://www.navision-blog.de/images/IntegratingaFAKEFMakebuildscriptinto.net_7967/image_thumb_6.png" width="500" height="249" /></a></p>
<p>Please feel free to give feedback if you have any problems with this article.</p>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2009/10/14/integrating-a-fake-f-make-build-script-into-cruisecontrol-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;FAKE &#8211; F# Make&#8221; Version 0.10 released</title>
		<link>http://www.navision-blog.de/2009/10/06/fake-fsharp_make_version_0_10_released/</link>
		<comments>http://www.navision-blog.de/2009/10/06/fake-fsharp_make_version_0_10_released/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 09:59:10 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2009/10/06/fake-fsharp_make_version_0_10_released/</guid>
		<description><![CDATA[I just released a new version of my Open Source Build Automation Framework “FAKE – F# Make”. You can read more about FAKE on the project website or in the Getting started with &#34;FAKE &#8211; F# Make&#34;-article. Although the new release contains many bugfixes, I only want to show the two major improvements here. 1. [...]]]></description>
			<content:encoded><![CDATA[<p>I just released a new version of my Open Source Build Automation Framework <a href="http://code.google.com/p/fake/">“FAKE – F# Make”</a>. You can read more about FAKE on the <a href="http://code.google.com/p/fake/">project website</a> or in the <a href="http://www.navision-blog.de/2009/04/01/getting-started-with-fake-a-f-sharp-make-tool/">Getting started with &quot;FAKE &#8211; F# Make&quot;</a>-article.</p>
<p>Although the new release contains many bugfixes, I only want to show the two major improvements here.</p>
<h4>1. FAKE 0.10 uses FSI instead of FSC</h4>
<p>From now on FAKE uses the “F# Interactive” (fsi.exe) instead of the F# Compiler (fsc.exe) to run the build scripts, which brings two major improvements.</p>
<h5>No TempPath for compiled binaries needed</h5>
<p>Due to the fact that FAKE scripts are no longer compiled at the beginning of the build process, we don’t need a temporary folder for the created binaries. </p>
<h5>Loading modules at runtime</h5>
<p>The <font color="#0080ff">#load</font> command in F# scripts allows us to load modules at runtime. Now we are able to put reusable Targets or TargetTemplates (see below) into external build script files.</p>
<h4>2. TargetTemplates</h4>
<p>TargetTemplates provide an easy way to reuse common Targets. Let’s consider a (very) small sample:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px">Target <span style="color: maroon">&quot;TraceHello&quot;</span> (<span style="color: blue">fun</span> () <span style="color: blue">-&gt;</span></p>
<p style="margin: 0px">&#160; trace <span style="color: maroon">&quot;Hello World from FAKE&quot;</span></p>
<p style="margin: 0px">)</p>
</p></div>
<p>This Target “TraceHello” traces a “Hello World” string into our build log. Now we want it to be slightly more generic and to trace a custom string. We can do this by using a TargetTemplate: </p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><span style="color: green">/// createTraceTarget: string -&gt; string -&gt; Target</span></p>
<p style="margin: 0px"><span style="color: blue">let</span> createTraceTarget = TargetTemplate (<span style="color: blue">fun</span> s <span style="color: blue">-&gt;</span></p>
<p style="margin: 0px">&#160; trace s</p>
<p style="margin: 0px">)</p>
</p></div>
<p>Now we have a template (or a function which generates targets) that gets a string for the target name and a string for the trace text and generates&#160; a usable target:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px">createTraceTarget <span style="color: maroon">&quot;TraceHello&quot;</span> <span style="color: maroon">&quot;Hello World from FAKE&quot;</span></p>
<p style="margin: 0px">createTraceTarget <span style="color: maroon">&quot;Trace2&quot;</span> <span style="color: maroon">&quot;Trace another text&quot;</span></p>
</p></div>
<p>Of course the TargetTemplate function is generic and can be used with any tuple as parameter:</p>
<div style="font-family: courier new; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><span style="color: green">/// createTraceTarget: string -&gt; string*int -&gt; Target</span></p>
<p style="margin: 0px"><span style="color: blue">let</span> createTraceTarget = TargetTemplate (<span style="color: blue">fun</span> (s,d) <span style="color: blue">-&gt;</span></p>
<p style="margin: 0px">&#160; trace s</p>
<p style="margin: 0px">&#160; trace &lt;| sprintf <span style="color: maroon">&quot;my int: %d&quot;</span> d</p>
<p style="margin: 0px">)</p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px">createTraceTarget <span style="color: maroon">&quot;TraceHello&quot;</span> (<span style="color: maroon">&quot;Hello World from FAKE&quot;</span>,2)</p>
<p style="margin: 0px">createTraceTarget <span style="color: maroon">&quot;Trace2&quot;</span> (<span style="color: maroon">&quot;Trace another text&quot;</span>,42)</p>
</p></div>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2009/10/06/fake-fsharp_make_version_0_10_released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Extensibility of functions with lambdas (in F# and C#)</title>
		<link>http://www.navision-blog.de/2009/07/01/extensibility-of-functions-with-lambdas-in-f-and-c/</link>
		<comments>http://www.navision-blog.de/2009/07/01/extensibility-of-functions-with-lambdas-in-f-and-c/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 14:02:25 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[English posts]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fake]]></category>
		<category><![CDATA[Functional Programming]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2009/07/01/extensibility-of-functions-with-lambdas-in-f-and-c/</guid>
		<description><![CDATA[One of the nice properties of functional programming languages is the easy extensibility of custom functions. Let’s consider a simple F# function (from “FAKE – F# Make”) for a recursive directory copy: open System open System.IO /// Copies a directory recursive /// Thanks to Robert Pickering http://strangelights.com/blog/ /// param target: target directory : string /// [...]]]></description>
			<content:encoded><![CDATA[<p>One of the nice properties of functional programming languages is the easy extensibility of custom functions. Let’s consider a simple F# function (from <a href="http://code.google.com/p/fake/">“FAKE – F# Make”</a>) for a recursive directory copy:</p>
<pre class="code"><span style="color: blue">open </span>System
<span style="color: blue">open </span>System.IO
<span style="color: green">
/// Copies a directory recursive
/// Thanks to Robert Pickering <a title="http://strangelights.com/blog/" href="http://strangelights.com/blog/">http://strangelights.com/blog/</a></span><span style="color: green">
///  param target: target directory : string
///  param source: source directory : string
</span><span style="color: blue">let </span>CopyDir target source =
  Directory.GetFiles(source, <span style="color: maroon">&quot;*.*&quot;</span>, SearchOption.AllDirectories)
    |&gt; Seq.iter (<span style="color: blue">fun </span>file <span style="color: blue">-&gt;
      let </span>newFile = target + file.Remove(0, source.Length)
      printf <span style="color: maroon">&quot;%s =&gt; %s&quot; </span>file newFile
      Directory.CreateDirectory(Path.GetDirectoryName(newFile)) |&gt; ignore
      File.Copy(file, newFile, <span style="color: blue">true</span>))</pre>
<p>If we want to allow users to set custom file filters, we can add a third parameter:</p>
<pre class="code"><span style="color: green">/// Copies a directory recursive
<strong>/// and allows to filter the files</strong>
<span style="color: green">/// Thanks to Robert Pickering <a title="http://strangelights.com/blog/" href="http://strangelights.com/blog/">http://strangelights.com/blog/</span></span><span style="color: green"></span></a>
<span style="color: green">///  param target: target directory : string
///  param source: source directory : string
<strong>///  param filterFile: FilterFunction: string -&gt; bool</strong>
</span><span style="color: blue">let </span>CopyDirFiltered target source <strong>filterFile</strong> =
  Directory.GetFiles(source, <span style="color: maroon">&quot;*.*&quot;</span>, SearchOption.AllDirectories)
    <strong>|&gt; Seq.filter filterFile</strong>
    |&gt; Seq.iter (<span style="color: blue">fun </span>file <span style="color: blue">-&gt;
      let </span>newFile = target + file.Remove(0, source.Length)
      printfn <span style="color: maroon">&quot;%s =&gt; %s&quot; </span>file newFile
      Directory.CreateDirectory(Path.GetDirectoryName(newFile)) |&gt; ignore
      File.Copy(file, newFile, <span style="color: blue">true</span>))</pre>
<p>Now we can define some filter functions:</p>
<pre class="code"><span style="color: green">/// Exclude SVN files (path with .svn)
/// excludeSVNFiles<strong>: string -&gt; bool</strong>
</span><span style="color: blue">let </span>excludeSVNFiles (path:string) = not &lt;| path.Contains <span style="color: maroon">&quot;.svn&quot;

</span><span style="color: green">/// Includes all files
/// allFiles<strong>: string -&gt; bool</strong> </span>
</span><span style="color: blue">let </span>allFiles (path:string) = <span style="color: blue">true</span></pre>
<p>Now it is possible to use CopyDirFiltered in the following ways:</p>
<pre class="code"><span style="color: green">/// Copies all files &lt;=&gt; same as CopyDir
</span>CopyDirFiltered <span style="color: maroon">&quot;C:\\target&quot; &quot;C:\\source&quot; </span>allFiles

<span style="color: green">/// Copies all files except SVN files
</span>CopyDirFiltered <span style="color: maroon">&quot;C:\\target&quot; &quot;C:\\source&quot; </span>excludeSVNFiles

<span style="color: green">/// Copies all files only if random number &lt;&gt; 2
</span><span style="color: blue">let </span>r = <span style="color: blue">new </span>Random()
CopyDirFiltered <span style="color: maroon">&quot;C:\\target&quot; &quot;C:\\source&quot; </span>(<span style="color: blue">fun </span>path <span style="color: blue">-&gt; </span>r.Next(5) &lt;&gt; 2)</pre>
<h5>Extensibility of functions in C#</h5>
<p>Of course we can do the same thing in C# 3.0:</p>
<pre class="code"><span style="color: gray">/// &lt;summary&gt;
/// </span><span style="color: green">Copies a directory recursive
</span><span style="color: gray">/// </span><span style="color: green">and allows to filter the files
</span><span style="color: gray">/// &lt;/summary&gt;
/// &lt;param name=&quot;target&quot;&gt;</span><span style="color: green">The target.</span><span style="color: gray">&lt;/param&gt;
/// &lt;param name=&quot;source&quot;&gt;</span><span style="color: green">The source.</span><span style="color: gray">&lt;/param&gt;
/// &lt;param name=&quot;fileFilter&quot;&gt;</span><span style="color: green">The file filter.</span><span style="color: gray">&lt;/param&gt;
</span><span style="color: blue">public static void </span>CopyDirFiltered(<span style="color: blue">string </span>target, <span style="color: blue">string </span>source,
                                   <span style="color: #2b91af">Func</span>&lt;<span style="color: blue">string</span>, <span style="color: blue">bool</span>&gt; fileFilter)
{
    <span style="color: blue">string</span>[] allFiles = <span style="color: #2b91af">Directory</span>.GetFiles(
        source, <span style="color: #a31515">&quot;*.*&quot;</span>, <span style="color: #2b91af">SearchOption</span>.AllDirectories);
    <span style="color: blue">foreach </span>(<span style="color: blue">string </span>file <span style="color: blue">in from </span>f <span style="color: blue">in </span>allFiles
                            <span style="color: blue">where </span>fileFilter(f)
                            <span style="color: blue">select </span>f)
    {
        <span style="color: blue">string </span>newFile = target + file.Remove(0, source.Length);
        <span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">&quot;{0} =&gt; {1}&quot;</span>, file, newFile);
        <span style="color: #2b91af">Directory</span>.CreateDirectory(<span style="color: #2b91af">Path</span>.GetDirectoryName(newFile));
        <span style="color: #2b91af">File</span>.Copy(file, newFile, <span style="color: blue">true</span>);
    }
}</pre>
<p>Now it is easy to use the C# function with lambdas:</p>
<blockquote>
<p>“A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.”</p>
<p align="right">[<a href="http://msdn.microsoft.com/en-us/library/bb397687.aspx">MSDN</a>]</p>
</blockquote>
<pre class="code"><span style="color: #2b91af">Func</span>&lt;<span style="color: blue">string</span>, <span style="color: blue">bool</span>&gt; filterSVN = x =&gt; !x.Contains(<span style="color: #a31515">&quot;.svn&quot;</span>);
<span style="color: #2b91af">Func</span>&lt;<span style="color: blue">string</span>, <span style="color: blue">bool</span>&gt; allFiles = x =&gt; <span style="color: blue">true</span>;

<span style="color: gray">/// </span><span style="color: green">Copies all files </span><span style="color: gray">&lt;=&gt; </span><span style="color: green">same as CopyDir
</span>CopyDirFiltered(<span style="color: #a31515">&quot;C:\\target&quot;</span>, <span style="color: #a31515">&quot;C:\\source&quot;</span>, allFiles);

<span style="color: gray">/// </span><span style="color: green">Copies all files except SVN files
</span>CopyDirFiltered(<span style="color: #a31515">&quot;C:\\target&quot;</span>, <span style="color: #a31515">&quot;C:\\source&quot;</span>, filterSVN);

<span style="color: gray">/// </span><span style="color: green">Copies all files only if random number </span><span style="color: gray">&lt;&gt; </span><span style="color: green">2
</span><span style="color: blue">var </span>r = <span style="color: blue">new </span><span style="color: #2b91af">Random</span>();
CopyDirFiltered(<span style="color: #a31515">&quot;C:\\target&quot;</span>, <span style="color: #a31515">&quot;C:\\source&quot;</span>, path =&gt; r.Next(5) != 2);</pre>
<p>Keeping this simple technique in mind allows to create very flexible functions.</p>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2009/07/01/extensibility-of-functions-with-lambdas-in-f-and-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>F# BootCamp &#8211; Questions and Answers &#8211; part II &#8211; Currying</title>
		<link>http://www.navision-blog.de/2009/06/17/f-bootcamp-questions-and-answers-part-ii-currying/</link>
		<comments>http://www.navision-blog.de/2009/06/17/f-bootcamp-questions-and-answers-part-ii-currying/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 10:36:07 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English posts]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[Informatik]]></category>
		<category><![CDATA[Mathematik]]></category>
		<category><![CDATA[Veranstaltungen]]></category>
		<category><![CDATA[.NET Developer Group Braunschweig]]></category>
		<category><![CDATA[.NET User Group Leipzig]]></category>
		<category><![CDATA[Currying]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>
		<category><![CDATA[partial  application]]></category>
		<category><![CDATA[pipe]]></category>
		<category><![CDATA[|>]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2009/06/17/f-bootcamp-questions-and-answers-part-ii-currying/</guid>
		<description><![CDATA[Yesterday I was talking about F# at the .NET Developer Group Braunschweig. It was my first talk completely without PowerPoint (just Live-Coding and FlipChart) and I have to admit this is not that easy. But the event was really a big fun and we covered a lot of topics like FP fundamentals, concurrency and domain [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was talking about F# at the <a href="http://www.dotnet-braunschweig.de/termindetails.aspx?id=36">.NET Developer Group Braunschweig</a>. It was my first talk completely without PowerPoint (just Live-Coding and FlipChart) and I have to admit this is not that easy. But the event was really a big fun and we covered a lot of topics like FP fundamentals, concurrency and domain specific languages (of course I showed “<a href="http://code.google.com/p/fake/">FAKE – F# Make”</a>).</p>
<p>Now I have a bit time before I go to the next BootCamp in Leipzig. Today <a href="http://blogs.thinktecture.com/cweyer/">Christian Weyer</a> will show us exciting new stuff about <a href="http://dotnet-leipzig.de/veranstaltungen/net-bootcamp-2009-3/">WCF and Azure</a>. </p>
<p>In the meanwhile I will write here about another important question (see <a href="http://www.navision-blog.de/2009/06/02/f-sharp-bootcamp-questions-and-answers-part-i-introduction/">first article</a>) from the <a href="http://dotnet-leipzig.de/veranstaltungen/net-bootcamp-2009-5/">F# BootCamp in Leipzig</a>:</p>
<h5>Question 4 – Try to explain “Currying” and “Partial Application”. Hint: Please show a sample and use the pipe operator |&gt;.</h5>
<p>Obviously this was a tricky question for FP beginners. There are a lot of websites, which give a formal mathematical definition but don’t show the practical application. </p>
<blockquote><p>“Currying … is the technique of transforming a function that takes multiple arguments (or more accurately an n-tuple as argument) in such a way that it can be called as a chain of functions each with a single argument”</p>
<p align="right">[<a href="http://en.wikipedia.org/wiki/Currying">Wikipedia</a>]</p>
</blockquote>
<p>I want to show how my pragmatic view of the terms here, so let’s consider this small C# function:</p>
<pre class="code"><span style="color: blue">public int </span>Add(<span style="color: blue">int </span>x, <span style="color: blue">int </span>y)
{
   <span style="color: blue">return </span>x + y;
}</pre>
<p>Of course the corresponding F# version looks nearly the same:</p>
<pre class="code"><span style="color: blue">let </span>add(x,y) = x + y</pre>
<p>But let’s look at the signature: <em>val add : int<strong> *</strong> int –&gt; int</em>. The F# compiler is telling us <strong>add </strong>wants a tuple of ints and returns an int. We could rewrite the function with one blank to understand this better:</p>
<pre class="code"><span style="color: blue">let </span>add (x,y) = x + y</pre>
<p>As you can see the add function actually needs only one argument – a tuple:</p>
<pre class="code"><span style="color: blue">let </span>t = (3,4)         <span style="color: green">// val t : int * int</span>
printfn <span style="color: maroon">&quot;%d&quot; </span>(add t)  <span style="color: green">// prints 7 – like add(3,4)</span></pre>
<p>Now we want to curry this function. If you’d ask a mathematician this a complex operation, but from a pragmatic view it couldn’t be easier. Just remove the brackets and the comma – that’s all:</p>
<pre class="code"><span style="color: blue">let </span>add x y = x + y</pre>
<p>Now the signature looks different: <em>val add : int<strong> -&gt;</strong> int –&gt; int</em></p>
<p>But what’s the meaning of this new arrow? Basically we can say if we give one int parameter to our add function we will get a function back that will take only one int parameter and returns an int.</p>
<pre class="code"><span style="color: blue">let </span>increment = add 1      <span style="color: green">// val increment : (int -&gt; int)
</span>printfn <span style="color: maroon">&quot;%d&quot; </span>(increment 2) <span style="color: green">// prints 3</span></pre>
<p>Here “increment” is a new function that uses partial application of the curryied add function. This means we are fixing one of the parameters of <strong>add </strong>to get a new function with one parameter less. </p>
<p>But why are doing something like this? Wouldn’t it be enough to use the following increment function?</p>
<pre class="code"><span style="color: blue">let </span>add(x,y) = x + y       <span style="color: green">// val add : int * int -&gt; int
</span><span style="color: blue">let </span>increment x = add(x,1) <span style="color: green">// val increment : int -&gt; int
</span>printfn <span style="color: maroon">&quot;%d&quot; </span>(increment 2) <span style="color: green">// prints 3</span></pre>
<p>Of course we are getting (nearly) the same signature for increment. But the difference is that we can not use the forward pipe operator <strong>|&gt;</strong> here. The pipe operator will help us to express things in the way we are thinking about it. </p>
<p>Let’s say we want to filter all even elements in a list, then calculate the sum and finally square this sum and print it to the console. The C# code would look like this:</p>
<pre class="code"><span style="color: blue">var </span>list = <span style="color: blue">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: blue">int</span>&gt; {4,2,6,5,9,3,8,1,3,0};
Console.WriteLine(Square(CalculateSum(FilterEven(list))));</pre>
<p>If we don’t want to store intermediate results we have to write our algorithm in reverse order and with heavily use of brackets. The function we want to apply last has to be written first. This is not the way we think about it. </p>
<p>With the help of curried functions, partial application and the pipe operator we can write the same thing in F#:</p>
<pre class="code"><span style="color: blue">let </span>list = [4; 2; 6; 5; 9; 3; 8; 1; 3; 0]

<span style="color: blue">let </span>square x = x * x</pre>
<pre class="code">list
 |&gt; List.filter (<span style="color: blue">fun </span>x <span style="color: blue">-&gt; </span>x % 2 = 0) <span style="color: green">// partial application
 </span>|&gt; List.sum
 |&gt; square
 |&gt; printfn <span style="color: maroon">&quot;%A&quot;                     </span><span style="color: green">// partial application</span></pre>
<p>We describe the data flow in exactly the same order we talked about it. Basically the pipe operator take the result of a function and puts it as the <strong>last</strong> parameter into the next function.</p>
<p>What should we learn from this sample? </p>
<ol>
<li>Currying has nothing to do with spicy chicken.</li>
<li>The |&gt; operator makes life easier and code better to understand.</li>
<li>If we want to use |&gt; we need curryied functions.</li>
<li>Defining curryied functions is easy – just remove brackets and comma.</li>
<li>We don’t need the complete mathematical theory to use currying.</li>
<li>Be careful with the order of the parameter in a curryied function. Don’t forget the pipe operator puts the parameter from the right hand side into your function – all other parameters have to be fixed with partial application. </li>
</ol>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2009/06/17/f-bootcamp-questions-and-answers-part-ii-currying/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating a &#8220;FAKE &#8211; F# Make&#8221; build script into TeamCity</title>
		<link>http://www.navision-blog.de/2009/04/15/integrate-a-fake-f-make-build-script-into-teamcity/</link>
		<comments>http://www.navision-blog.de/2009/04/15/integrate-a-fake-f-make-build-script-into-teamcity/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 09:00:12 +0000</pubDate>
		<dc:creator>Steffen Forkmann</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[FAKE - F# Make]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Code Quality]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[F-sharp Make]]></category>
		<category><![CDATA[Fake]]></category>
		<category><![CDATA[FxCop]]></category>
		<category><![CDATA[nunit]]></category>
		<category><![CDATA[TeamCity]]></category>

		<guid isPermaLink="false">http://www.navision-blog.de/2009/04/15/integrate-a-fake-f-make-build-script-into-teamcity/</guid>
		<description><![CDATA[Easy TeamCity integration is one of the major goals for the FAKE build system. “TeamCity is a Java-based build management and continuous integration server from JetBrains, creators of IntelliJ IDEA and ReSharper.” [Wikipedia] In this article I will show you how you can set up a FAKE build script in TeamCity. We will use the [...]]]></description>
			<content:encoded><![CDATA[<p>Easy <a href="http://www.jetbrains.com/teamcity/">TeamCity</a> integration is one of the major goals for the <a href="http://code.google.com/p/fake/">FAKE build system</a>.</p>
<blockquote><p><b>“TeamCity</b> is a <a href="http://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a>-based <a href="http://en.wikipedia.org/wiki/Software_build">build</a> management and <a href="http://en.wikipedia.org/wiki/Continuous_integration">continuous integration</a> server from <a href="http://en.wikipedia.org/wiki/JetBrains">JetBrains</a>, creators of <a href="http://en.wikipedia.org/wiki/IntelliJ_IDEA">IntelliJ IDEA</a> and <a href="http://en.wikipedia.org/wiki/ReSharper">ReSharper</a>.”</p>
<p align="right">[<a href="http://en.wikipedia.org/wiki/TeamCity">Wikipedia</a>] </p>
</blockquote>
<p>In this article I will show you how you can set up a FAKE build script in TeamCity. We will use the CalculatorSample which you can download from the <a href="http://code.google.com/p/fake/downloads/list">FAKE Download page</a>. If you want to know how this build script works read the <a href="http://www.navision-blog.de/2009/04/01/getting-started-with-fake-a-f-sharp-make-tool/">“Getting started with FAKE”-tutorial</a>.</p>
<h5>Installing TeamCity</h5>
<p>You can download the free professional edition of TeamCity from <a href="http://www.jetbrains.com/teamcity/">http://www.jetbrains.com/teamcity/</a>. After the installation process (<a href="http://www.navision-blog.de/2009/01/08/how-i-do-continuous-integration-part-ii-continuous-integration-server/">further instructions</a>) you should be ready to configure your first build:</p>
<p><img style="display: inline" class="bordered" title="Create project on your TeamCity Server" alt="Create project on your TeamCity Server" src="http://www.navision-blog.de/images/HowIdoContinuousIntegrationwithmyCFproje_AD6B/image_4.png" width="500" height="350" /></p>
<h5>Creating a FAKE Project</h5>
<p>Now create a new project and add a build configuration:</p>
<p><img class="bordered" title="Create Calculator project" alt="Create Calculator project" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image.png" width="500" height="188" /></p>
<p><img class="bordered" title="General Settings" alt="General Settings" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image_3.png" width="500" height="475" /></p>
<h5>Attach a VCS root</h5>
<p>The next step is to attach a VCS root. For this sample we will use the Calculator SVN root at <a href="http://fake.googlecode.com/svn/trunk/Samples/Calculator/">http://fake.googlecode.com/svn/trunk/Samples/Calculator/</a>.</p>
<p>[The only issue with this setting is, that you can’t change the path to the F# compiler. It is fixed to <em>c:\Program Files (x86)\FSharp-1.9.6.2\bin\.</em> If your path is different just reinstall F# to this location or use your own Version Control System.]</p>
<p><img class="bordered" title="VCS root" alt="VCS root" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image_4.png" width="500" height="430" /></p>
<p><img class="bordered" title="Test connection" alt="Test connection" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image_5.png" width="500" height="506" /></p>
<h5>Choosing a build runner</h5>
<p>We can use the Command Line build runner to start the completeBuild.fsx build script via Fake.exe. As the build provides NUnit test results we instruct TeamCity to import them:</p>
<p><img class="bordered" title="Choosing build runner" alt="Choosing build runner" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image_6.png" width="500" height="446" /></p>
<p>If you want you could also add a build trigger to your build script:</p>
<p><img class="bordered" title="Enable triggering when files are checked into VCS" alt="Enable triggering when files are checked into VCS" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image_7.png" width="500" height="411" /></p>
<h5>Running the build</h5>
<p>Now if everything is configured correctly, you can run your build and the output should look like:</p>
<p><img class="bordered" title="Running first FAKE build script in TeamCity" alt="Running first FAKE build script in TeamCity" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image_8.png" width="500" height="164" /></p>
<p>You can also inspect the NUnit and FxCop results:</p>
<p><img class="bordered" title="NUnit test results" alt="NUnit test results" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image_9.png" width="500" height="105" /> </p>
<p><img class="bordered" title="FxCop results" alt="FxCop results" src="http://www.navision-blog.de/images/IntegrateaFAKEFMakebuildscriptintoTeamCi_9A95/image_10.png" width="500" height="223" /></p>
<p>&copy;2010 <a href="http://www.navision-blog.de">Rash thoughts about .NET, C#, F# and Dynamics NAV.</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.navision-blog.de/2009/04/15/integrate-a-fake-f-make-build-script-into-teamcity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
