tags:

views:

302

answers:

6

I have a project with 2 subfolders in the App_code folder, one for VB and one for F# (C# files are in the root). I can access the VB classes just fine (via the namespace) but not the F# code. Has anyone had a problem like this and if so how did you fix it?

Addendum: F# code that is not in the App_Code folder runs just fine. Is is as if the compiler and IDE do not see the F# code that is in a subfolder of the App_Code folder called FS_Code. I have added the codeSubDirectories element

<codeSubDirectories>       
<add directoryName="VB_Code"/>
    <add directoryName="FS_Code"/>
</codeSubDirectories>

The VB code in the VB_Code subfolder compiles just fine.

A: 

Open up the actual generated assemblies via Reflector - see what the actual namespacing is.

Paul Betts
+1  A: 

Note that by default, if you don't declare a namespace or module, top-level F# code ends up in a module with the same name as the filename. See the first part of

http://lorgonblog.spaces.live.com/blog/cns!701679AD17B6D310!444.entry

for details.

Brian
+1  A: 

Step 3: Profit!!

Seriously, just placing a F# source file under App_Code is not gonna do anything.

What preparation tasks have you done so F# code can be compiled by the ASP.NET application?

leppie
+1 for the underpants gnomes, lol
seanb
ASPX pages with F# code behind files work just fine.
Rodrick Chapman
+1  A: 

Perhaps check out

http://cs.hubfs.net/blogs/tomasp/archive/2008/03/08/aspnet_in_fsharp.aspx

Brian
A: 

Hi, I believe that adding the <compiler ... /> configuration element for the F# language to the web.config should help (see the link Brian posted) - however, I doubt you'd see anything in the C# IntelliSense. However, it's not clear to me how you can reference code in one language from the code in the other...

You can also check out this link: http://shailkpatel.blogspot.com/2007/10/multiple-programming-languages-in.html

Tomas Petricek
The compiler element is in the web.config file and F# code that is not in the App_Code directory runs just fine. It is as if the compiler and IDE cannot see the code in the Fsharp subfolder of the App_Code directory (although it can see the VB subfolder code just fine.
Rodrick Chapman
A: 

It's been a while since I asked this question but I think it ended up being a problem with the F# compiler not being in $PATH (I had it installed in a non standard location).

Rodrick Chapman