8

Im trying to write a simple F# ASP.Net MVC app

Ive added the Global.asax as follows

<%@ Application Inherits="WebApplication.Core.Global" Language="F#" %>

then in a separate referenced assembly I have

namespace WebApplication.Core  with a type Global() = etc

Getting a 'F#' is not a supported language.

Am I not able to do this?

Thanks

tereško
  • 58,060
  • 25
  • 98
  • 150
Chris McKelt
  • 1,378
  • 2
  • 17
  • 38

1 Answers1

7

You need to add something like below in web.config:

<compiler language="F#;f#;fs;fsharp"
          extension=".fs"
          warningLevel="4"
          type="Microsoft.FSharp.Compiler.CodeDom.FSharpAspNetCodeProvider,
            FSharp.Compiler.CodeDom, Version=1.9.6.2,
            Culture=neutral,
            PublicKeyToken=a19089b1c74d0809">
  <providerOption name="CompilerVersion" value="v3.5" />
  <providerOption name="WarnAsError" value="false" />
</compiler>

Source and more details: http://codebetter.com/matthewpodwysocki/2008/10/07/asp-net-mvc-with-nhaml-f-edition/

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • 4
    You can avoid having to do this by placing the class that implements your global.asax (a System.Web.HttpApplication) in an F# assembly and referencing this type in the "Inherits" attribute in global.asax. This is how the F# MVVM template works (available in visual studios online templates). – Robert May 01 '11 at 06:36
  • @Robert: can you post your comment as a new answer (and I will upvote it)? – knocte Jan 23 '15 at 11:29