Tuesday, August 5, 2008

NAnt extension for F#

I love F#. I am trying to use this language for all my projects. However, as an proud owner of MacBook, it hard to cope with usage of F# under Mono, especially when you have tried F# integration with Visual Studio.

What could be done to ease burden of command line experience? For long time Mono have been using NAnt for automating building process. So, while team from Microsoft is trying to bring F# to production, NAnt extension that could automate building task for F# sounds as helper in command line environment.

Here you can find source code and binary for this extension.

There are several steps in installation process:
  1. Copy binary NAnt.FSharpTask.dll in nant\bin directory

  2. Insert this task description into NAnt.exe.config file under desired framework section:
    <task name="fsc">
    <attribute name="exename">
    c:\Program Files\FSharp-1.9.4.19\bin\fsc.exe
    </attribute>
    </task>
  3. Change exename property to path to your F# compiler
Next step is to configure .build file. Here is small example:

<fsc target="exe" output="HelloWorld.exe" debug="true">

<sources>

<include name="HelloWorld.fs" />

</sources>

<references>

<include name="System.dll" />

</references>

</fsc>

For more information see How to use F# extension for NAnt

No comments: