Sunday, January 23, 2011

FSRepository - A New NuGet Package

UPDATED: NuGet Package Manager 1.1 (release today - 2/12/2011) now supports F#!

A new NuGet package is now available in the NuGet gallery called FSRepository. This package adds a few F# source files and assembly references to your F# project so that EFCodeFirst 0.8 can be used for data access.

What is NuGet?
If you haven't heard, "NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio. When you use NuGet to install a package, it copies the library files to your solution and automatically updates your project (add references, change config files, etc). If you remove a package, NuGet reverses whatever changes it made so that no clutter is left." (

What is EFCodeFirst?
I first heard about EFCodeFirst in a blog post by Steve Sanderson. In that post he states "In case you’re wondering, EFCodeFirst is the new super-elegant version of Entity Framework that persists plain .NET objects to a relational database without any configuration fuss...".

How Do I Use FSRepository 0.4?
Support for F# projects was added to NuGet by David Fowler on 1/20/2011. Because this is such a recent addition, the version of the NuGet Package Manager on Visual Studio Gallery doesn't yet have this functionality. However, you can get the latest from to create a version of the visual studio extension that contains this functionality (or just wait for a few days/weeks until the next version is released on Visual Studio Gallery). If neither of these options work for you, shoot me an email and we can discuss alternatives.

Once a version of NuGet Package Manager that includes support for F# projects is installed, you can install the FSRepository 0.3 package by doing the following:

1. Create or open a F# project.
2. Open the Package Manager Console window (this can be found in Visual Studio 2010 under View -> Other Windows -> Package Manager Console).
3. In the Package Manager Console, type "Install-Package FSRepository":

4. Hit "Enter" and wait for several seconds until you see something like this:

As long as there were no errors, your F# project should now contain the new assembly references and F# source files.

You can find the files that were used to create this NuGet package on my GitHub.

Thursday, January 20, 2011

New F# Empty Web Application (Silverlight) Template

There is a new F# Silverlight application template up on Visual Studio Gallery that generates an "empty" Silverlight solution. The generated solution provides the necessary structure to start F# Silverlight development, but does not include any sample code. While the previously provided F# Silverlight template (discussed at provides a nice example, it's not always useful if you have a need for an entirely different type of application.

The new F# Empty Web Application (Silverlight) template can be downloaded from the web or through the Online Templates feature of Visual Studio 2010.

Here are the steps: (Note: Visual Studio 2010 Professional (or above) is required to use this template.)

1. In Visual Studio 2010, navigate to File -> New and select Online Templates.
2. Search for "Daniel Mohl" or "F# Empty Web Application (Silverlight)":

As with most of the things posted on this blog, you can find the full source used to create this template on my GitHub site.

Sunday, January 16, 2011

New F# ASP.NET MVC 3 Template on Visual Studio Gallery

There is a new F# ASP.NET MVC 3 project template on Visual Studio Gallery. This template is a version of the F# ASP.NET MVC 2 project template that has been migrated to ASP.NET MVC 3. ASP.NET MVC 3 has several cool new features. Check out and for more information.

To get started, do the following (Note: Visual Studio 2010 Professional (or above) is required to use these templates):

1. Install ASP.NET MVC 3. View for more information.
2. In Visual Studio 2010, go to File -> New and select Online Templates.
3. Search for Daniel Mohl or "F# and C# ASP.NET MVC3":

As usual, you can find the full solution used to create this template on my GitHub.