Monday, March 26, 2012

A Nice Addition to the Empty WPF F# Template

A few days ago Steffen Formann announced a Xaml type provider that he and Johann Deneux have created that makes writing WPF apps in F# very easy. This type provider allows strongly typed access to the XAML, effectively providing the missing piece to allowing full F# WPF designer support. I've now updated the Empty WPF F# Template to include this type provider.

To use it, all you have to due is download/install the latest version of the F# Empty Windows App (WPF) template in VS11. This will generate an F# project with all the needed WPF assembly references. It also automatically installs the FSharpx.TypeProviders NuGet package and provides the starting point for creating WPF apps with the new Xaml type provider.

Here's a screenshot that's pretty similar to what Steffen showed in the announcement post. Note: The button and label were manually added after creating the project from the updated template.


One other piece that can be helpful when creating WPF apps in F# is the XAML related item templates (i.e. Page, User Control, Window, etc). Item templates are provided via the F# XAML Item Templates extension found at http://visualstudiogallery.msdn.microsoft.com/06c6ece1-2084-4083-a0f7-934fce9d22fb.

Saturday, March 17, 2012

Presentation - CoffeeScript: Good, Bold, and with Sugar

Thanks to all who came out to my talk yesterday at Code PaLOUsa. As mentioned, the slides for the presentation are provided below. You can find the slides + examples at https://github.com/dmohl/CoffeeScriptGoodBoldAndWithSugar and navigate the deck at Slides

Monday, March 5, 2012

F# and ASP.NET Web API

A few weeks ago the ASP.NET team announced the release of ASP.NET MVC 4 Beta. You can read about it here. One of the exciting features that was announced is ASP.NET Web API. ASP.NET Web API provides an excellent programming model for building HTTP services.

One of the sweet spots for F# is in the services layer and this makes ASP.NET Web API + F# great friends. To make it easy to get started with F# and ASP.NET Web API, I've added an ASP.NET Web API template to the already existing F#/C# ASP.NET MVC 4 Visual Studio extension. Note: The template requires that ASP.NET MVC 4 Beta is installed.

To install the template, do the following:

1. Launch the project creation wizard (Ctrl+Shift+N), select Online in the left hand nav, search for "fsharp mvc4", and click OK. In VS11 Beta, it looks something like the following. Note: It may take a few seconds to download.


2. After clicking OK and installing the extension, you will see a dialog that allows the creation of a new ASP.NET Web API solution with an F# project that contains the server-side code.


3. Once the project has been created, you can run it however you desire and hit the service via http://localhost:###/api/values.