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." (http://www.nuget.org/)

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 http://nuget.codeplex.com/ 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.

4 comments:

  1. I downloaded the latest NuGet build from CodePlex, but it didn't include F# support. So I downloaded the source and tried to build it myself, but my version of Visual Studio doesn't seem to include support for VS Extension projects. Any idea how else to get an up-to-date version, or when the official version will be updated?

    ReplyDelete
  2. Send me your email address (to dmohl at yahoo.com) and I'll send you the version that I built to test this package.

    ReplyDelete
  3. Also, to build the VS extension you'll need to install the VS2010 SDK. You'll also need to increase the VSIX version number in order to allow it to install over your current version. If all else fails, you can download a version that I have compiled (click here). This version is not supported, comes as is, and is not official. Use it at your own risk.

    ReplyDelete
  4. A recent release of the NuGet Package Manager on Visual Studio Gallery now supports F#.

    ReplyDelete