Tuesday, April 27, 2010

Launching an F# web application inside VS2010 as if it were C#

This is a follow-up to my comments on VS launcher for F# web apps, where I can put an example of the changed markup to the F# class library project to make it act like a web project and launch a browser with your Default.aspx page when you hit F5.

First, add the highlighted element to the topmost <PropertyGroup> clause in the .fsproj file thus:

where the first GUID is for web app, and the second for F# (as you can see by looking for the project in the solution file).

At the bottom of a C# web application .csproj you will find a block of code like

which you just want to copy and paste into your F# project following the

or equivalent line.

Now adding a trivial Default.aspx file containing

Welcome to ASP.NET on F#!

and the default web.config from a C# web project to the F# library, and running the project launches me that trivial web page into Firefox.

Actually getting F# to play nice with ASP.Net, I leave to those more versed in the latter.

No comments :