Monday, November 19, 2012

F#, ASP.NET MVC, and MonoDevelop

I often talk about creating web solutions with F# in Visual Studio. Today I'm going to switch things up a little and provide an example of an ASP.NET MVC solution built with MonoDevelop.

MonoDevelop:

For those that aren't familiar with MonoDevelop, it's an open source IDE that runs on a variety of operating systems including Windows, Mac OSX, and Linux. MonoDevelop works hand-in-hand with Mono, which is "an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET". This means that you can write the same .NET code that you would in Visual Studio and run it on any of the most popular operating systems.

Getting Setup for F# Development:

There are a number of resources out there that talk about how to get your environment setup with MonoDevelop and F#. Here's a quick set of steps:

1. Install MonoDevelop, .NET or Mono, and GTK# from http://monodevelop.com/Download.

2. Launch MonoDevelop and open the Add-in Manager (MonoDevelop | Add-in Manager... on Mac OSX and Tools | Add-in Manager on Windows).

3. Switch to the Gallery tab and install "F# Language Binding".

That's it. You're now ready to start building F# applications with MonoDevelop.

An ASP.NET MVC Project with F# and MonoDevelop:

MonoDevelop also supports ASP.NET MVC. To see an example, clone https://github.com/dmohl/FsMvc4MonoSample and open the solution.

The solution includes 2 projects:

1. A web project that includes Views and Controllers.
2. A unit testing project.

A screenshot of the Solution window is shown below:


2 comments:

  1. Dan has added this as a template to the standard F# language addin for MonoDevelop and this has been published, see https://groups.google.com/forum/?fromgroups=#!topic/fsharp-opensource/8_dFacVghF0

    ReplyDelete